Skip to content

Commit

Permalink
feat: support test for windows & mypy check
Browse files Browse the repository at this point in the history
  • Loading branch information
agusmakmun committed Apr 7, 2024
1 parent e75f295 commit edd6462
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
Expand Down
12 changes: 12 additions & 0 deletions docs/build-publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ Executing the script:
$ hatch run python src/scanreq/__main__.py -r requirements.txt -p .
```

Check the type checking using `mypy`:

```console
hatch run types:check src/
```

OR:

```console
hatch run mypy src/
```


### 3. Versioning

Expand Down
12 changes: 6 additions & 6 deletions src/scanreq/scanner.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import multiprocessing
import os
import re
from typing import List, Optional, Tuple
from typing import Any, List, Optional, Tuple

import importlib_metadata

Expand All @@ -17,7 +17,7 @@
"""

# allowed extensions to scan
DEFAULT_ALLOWED_EXTENSIONS: Tuple[str] = (
DEFAULT_ALLOWED_EXTENSIONS: Tuple[str, ...] = (
".py",
".conf",
".cfg",
Expand Down Expand Up @@ -111,7 +111,7 @@ def search_string_in_python_files(directory: str, search_string: str) -> List[st
Returns:
- A list of strings containing the paths to the files where the search_string was found.
"""
found_files: List[str] = []
found_files: List[Any] = []
pool = multiprocessing.Pool()
for root, _, files in os.walk(directory):
for file_name in files:
Expand All @@ -132,8 +132,8 @@ def clean_package_name(package_name: str) -> str:
For example:
- "django==3.2" -> "django", "Django==3.2" -> "django"
- "Flask>=1.0" -> "flask", "Flask<=1.0" -> "flask"
- "django-cookie-cutter<2.0" -> "django-cookiecutter"
- "django-cookie-cutter>2.0" -> "django-cookiecutter"
- "django-cookie-cutter<2.0" -> "django-cookie-cutter"
- "django-cookie-cutter>2.0" -> "django-cookie-cutter"
- "NumPy" -> "numpy"
Args:
Expand Down Expand Up @@ -181,7 +181,7 @@ def read_requirements(file_path: str) -> List[str]:
def scan(
requirement_file: str,
project_path: str,
output_path: str = None,
output_path: Optional[str] = None,
ignored_packages: List[str] = [],
) -> None:
"""
Expand Down

0 comments on commit edd6462

Please sign in to comment.