Skip to content

Commit 9e28aaf

Browse files
committed
Simplify check, extend README
1 parent 1d6ad0d commit 9e28aaf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Add this to your `.pre-commit-config.yaml`
9090
- `--indent ...` - Control the indentation (either a number for a number of spaces or a string of whitespace). Defaults to 4 spaces.
9191
- `--no-sort-keys` - when autofixing, retain the original key ordering (instead of sorting the keys)
9292
- `--top-keys comma,separated,keys` - Keys to keep at the top of mappings.
93-
- `requirements-txt-fixer` - Sorts entries in requirements.txt
93+
- `requirements-txt-fixer` - Sorts entries in requirements.txt and removes incorrect entry for `pkg-resources==0.0.0`
9494
- `sort-simple-yaml` - Sorts simple YAML files which consist only of top-level keys, preserving comments and blocks.
9595
- `trailing-whitespace` - Trims trailing whitespace.
9696
- Markdown linebreak trailing spaces preserved for `.md` and`.markdown`;

pre_commit_hooks/requirements_txt_fixer.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ def fix_requirements(f):
6969
else:
7070
rest = []
7171

72+
# find and remove pkg-resources==0.0.0
73+
# which is automatically added by broken pip package under Debian
7274
for requirement in requirements:
73-
if b'pkg-resources' in requirement.name:
74-
if b'0.0.0' in requirement.value:
75-
requirements.remove(requirement)
75+
if requirement.value == b'pkg-resources==0.0.0\n':
76+
requirements.remove(requirement)
7677

7778
for requirement in sorted(requirements):
7879
after.extend(requirement.comments)

0 commit comments

Comments
 (0)