Skip to content

Commit 2b4e4e9

Browse files
Refine AI context files
1 parent b200cc3 commit 2b4e4e9

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,15 @@ logger = logging.getLogger(__name__)
8484
from typing import Optional, List, Dict
8585
def process_data(items: List[Dict[str, Any]]) -> Optional[str]:
8686
...
87+
88+
# URL parameter validation (required pattern)
89+
def parse_positive_int_param(value: Optional[str], name: str) -> int:
90+
"""Validate and parse a URL parameter as a positive integer."""
91+
try:
92+
parsed = int(value) # type: ignore[arg-type]
93+
if parsed <= 0:
94+
raise ValueError(f"{name} must be positive")
95+
return parsed
96+
except (ValueError, TypeError):
97+
raise ValueError(f"Invalid {name}: expected a positive integer")
8798
```

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ and its design.
55

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

8+
**Before submitting a PR:**
9+
- Run `task test` and ensure all tests pass
10+
- Update tests for any methods/subroutines you modify
11+
- Validate URL parameters before parsing (use bounds checking, not bare `int()` or `parseInt()`)
12+
- Do not commit secrets, credentials, or hardcoded tokens
13+
814
## Updating the dependencies
915

1016
```bash

0 commit comments

Comments
 (0)