GeezerVison is showing github.com — requirements-txt-fixer doesn't support comments with indent · Issue #548 · pre-commit/pre-commit-hooks
requirements-txt-fixer doesn't support comments with indent #548
Description
Consider following example requirements.txt file:
# This comment is fine
a==0.0.1
# This comment is not fine
b==0.0.2
# This comment is fine too
Script requirements_txt_fixer.py will fail with AssertionError on line # This comment is not fine.
Activity
asottile commented on Jan 17, 2021
I kind of agree with the assertion error -- why is that indented?
greshilov commented on Jan 17, 2021
ContributorAuthor
More actions
I kind of agree with the assertion error -- why is that indented?
it doesn't violate the rules. For example pip-compile tool from pip-tools package generates files with following structure:
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --allow-unsafe requirements/dev.in
#
aiodns==2.0.0 ; sys_platform == "linux" or sys_platform == "darwin" and python_version >= "3.7"
# via -r requirements/base.txt
aiohttp-theme==0.1.6
# via
# flake8-pyi
# pytest
babel==2.9.0
...
asottile commented on Jan 17, 2021
if you're using pip-tools there's no reason to use this hook (as it sorts)
greshilov commented on Jan 17, 2021
ContributorAuthor
More actions
if you're using pip-tools there's no reason to use this hook (as it sorts)
Agree.
But it shows that some developers may use indents before comments (it's just a matter of taste).
pip itself is ok with indented comments, so why this tool is not?
asottile commented on Jan 17, 2021
pip itself is ok with indented comments, so why this tool is not?
pip is also ok with unsorted requirements files -- this tool implements a very specific style decision
Metadata
Metadata
Development
No branches or pull requestsIssue actions