Simplify check, extend README

This commit is contained in:
Michał Sochoń 2018-03-26 00:02:23 +02:00
parent 1d6ad0d6ed
commit 9e28aaf275
2 changed files with 5 additions and 4 deletions

View file

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

View file

@ -69,9 +69,10 @@ def fix_requirements(f):
else: else:
rest = [] rest = []
# find and remove pkg-resources==0.0.0
# which is automatically added by broken pip package under Debian
for requirement in requirements: for requirement in requirements:
if b'pkg-resources' in requirement.name: if requirement.value == b'pkg-resources==0.0.0\n':
if b'0.0.0' in requirement.value:
requirements.remove(requirement) requirements.remove(requirement)
for requirement in sorted(requirements): for requirement in sorted(requirements):