Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ logger = logging.getLogger(__name__)
from typing import Optional, List, Dict
def process_data(items: List[Dict[str, Any]]) -> Optional[str]:
...

# URL parameter validation (required pattern)
def parse_positive_int_param(value: Optional[str], name: str) -> int:
"""Validate and parse a URL parameter as a positive integer."""
try:
parsed = int(value) # type: ignore[arg-type]
if parsed <= 0:
raise ValueError(f"{name} must be positive")
return parsed
except (ValueError, TypeError):
raise ValueError(f"Invalid {name}: expected a positive integer")
```
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ and its design.

Once you are ready to submit your contribution, please fork the repository and open a pull request with your changes.

**Before submitting a PR:**
- Run `task test` and ensure all tests pass
- Update tests for any methods/subroutines you modify
- Validate URL parameters before parsing (use bounds checking, not bare `int()` or `parseInt()`)
- Do not commit secrets, credentials, or hardcoded tokens

## Updating the dependencies

```bash
Expand Down
Loading