Skip to content

Commit 91fa639

Browse files
committed
chore: replace safety by pip-audit due to license change
1 parent b8091ca commit 91fa639

File tree

5 files changed

+514
-363
lines changed

5 files changed

+514
-363
lines changed

.github/workflows/python.yaml

+6-3
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,12 @@ jobs:
9292
- name: Black
9393
if: always()
9494
run: poetry run black --check --diff .
95-
- name: Safety
96-
if: always()
97-
run: poetry run safety check
95+
- name: Pip-Audit
96+
if: ${{ matrix.os == 'ubuntu-22.04' }}
97+
run:
98+
bash -c "poetry run pip-audit --progress-spinner=off --strict -r
99+
<(poetry export -f requirements.txt --with dev | sed 's/\[.*\]//g' |
100+
sed -z 's/\n\W//g' | uniq )"
98101
- name: Pytest
99102
run: poetry run pytest -vv -m "not skip_on_gh" --cov --cov-report=xml
100103
- name: Coverage

.pre-commit-config.yaml

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@ repos:
3131
entry: poetry run black src/normcap src/tests/ package/
3232
types: [python]
3333

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

4247
- id: ruff

package/platforms/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def patch_file(
204204
205205
Indents the patch like the line after which it is inserted.
206206
"""
207-
patch_hash = hashlib.md5(patch.encode()).hexdigest()
207+
patch_hash = hashlib.md5(patch.encode()).hexdigest() # noqa: S324
208208

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

0 commit comments

Comments
 (0)