Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace safety by pip-audit due to license change #340

Merged
merged 1 commit into from
Jan 6, 2023
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ jobs:
- name: Black
if: always()
run: poetry run black --check --diff .
- name: Safety
if: always()
run: poetry run safety check
- name: Pip-Audit
if: ${{ matrix.os == 'ubuntu-22.04' }}
run:
bash -c "poetry run pip-audit --progress-spinner=off --strict -r
<(poetry export -f requirements.txt --with dev | sed 's/\[.*\]//g' |
sed -z 's/\n\W//g' | uniq )"
- name: Pytest
run: poetry run pytest -vv -m "not skip_on_gh" --cov --cov-report=xml
- name: Coverage
Expand Down
13 changes: 9 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@ repos:
entry: poetry run black src/normcap src/tests/ package/
types: [python]

- id: safety
name: safety
- id: pip-audit
name: pip-audit
stages: [commit]
language: system
entry: poetry run safety check
types: [python]
entry:
bash -c "poetry run pip-audit --strict -r <(poetry export -f
requirements.txt --with dev | sed 's/\[.*\]//g' | sed -z 's/\n\W//g' |
uniq )"
# First `sed` removes potential "[<extra>]" after package names
# Second `sed` removes "\n" in front of "--hash" to get one line per package
# Final `uniq` is the used to de-duplicated those lines
pass_filenames: false

- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion package/platforms/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def patch_file(

Indents the patch like the line after which it is inserted.
"""
patch_hash = hashlib.md5(patch.encode()).hexdigest()
patch_hash = hashlib.md5(patch.encode()).hexdigest() # noqa: S324

with open(file_path, encoding="utf8") as f:
if f.read().find(patch_hash) > -1:
Expand Down
Loading