andreoliwa / nitpick Goto Github PK
View Code? Open in Web Editor NEWEnforce the same settings on multiple projects
Home Page: https://nitpick.readthedocs.io/
License: MIT License
Enforce the same settings on multiple projects
Home Page: https://nitpick.readthedocs.io/
License: MIT License
I tried the text plugin to check a yaml file using this style
[[".gitlab-ci.yml".contains]]
line = " - mypy -p ims --junit-xml report-mypy.xml"
[[".gitlab-ci.yml".contains]]
line = " - apache-license-check --copyright \"2019-2020 SURF\" ims"
[[".gitlab-ci.yml".contains]]
line = " - flake8 --tee --output-file flake8.txt; exit_code=$?; flake8_junit flake8.txt report-flake8.xml"
[[".gitlab-ci.yml".contains]]
line = " - if [ $exit_code -ne 0 ]; then exit 1; fi;"
[[".gitlab-ci.yml".contains]]
line = " - isort -c ims"
[[".gitlab-ci.yml".contains]]
line = " - black --check ."
[[".gitlab-ci.yml".contains]]
line = " - pytest --cov=ims --cov-branch --junitxml=report-pytest-unit.xml --cov-fail-under="
It fails because the text plugin only accepts plain-text
files and thus it gives an error about files not being configured correctly
I expect the text plugin to always work (maybe even with binary files) since it provides an escape hatch for unsupported formats or weird files where inspect might do the wrong thing
nitpick
version used: Latest
Python version: 3.8
Operating System and version: Ubuntu 20.04
I create this style preset:
[nitpick.files.".editorconfig"]
missing_message = "Create .editorconfig file"
I want to be sure that this file always exists.
But, that's what I get:
» flake8 .
./tests/test_version.py
1:1 NIP001 File editorconfig.toml has an incorrect style. Invalid TOML:
TomlDecodeError: Invalid group name 'editorconfig"'. Try quoting it. (line 3 column 1 char 30)
# -*- coding: utf-8 -*-
How can I start filename with the .
char?
I expect nitpick
to run with no exceptions. But that's what I get:
wemake-services/wemake-python-styleguide#794
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/click/termui.py", line 372, in style
bits.append('\033[%dm' % (_ansi_colors.index(fg) + 30))
ValueError: tuple.index(x): x not in tuple
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/usr/local/lib/python3.7/site-packages/flake8/checker.py", line 666, in _run_checks
return checker.run_checks()
File "/usr/local/lib/python3.7/site-packages/flake8/checker.py", line 598, in run_checks
self.run_ast_checks()
File "/usr/local/lib/python3.7/site-packages/flake8/checker.py", line 502, in run_ast_checks
for (line_number, offset, text, check) in runner:
File "/usr/local/lib/python3.7/site-packages/nitpick/plugin.py", line 58, in run
yield from checker.check_exists()
File "/usr/local/lib/python3.7/site-packages/nitpick/files/base.py", line 87, in check_exists
yield from self.check_rules()
File "/usr/local/lib/python3.7/site-packages/nitpick/files/setup_cfg.py", line 67, in check_rules
yield from self.show_missing_keys(section, key, values)
File "/usr/local/lib/python3.7/site-packages/nitpick/files/setup_cfg.py", line 106, in show_missing_keys
yield self.flake8_error(4, ": section [{}] has some missing key/value pairs. Use this:".format(section), output)
File "/usr/local/lib/python3.7/site-packages/nitpick/mixin.py", line 20, in flake8_error
click.style("\n{}".format(suggestion.rstrip()), fg="bright_green") if suggestion else ""
File "/usr/local/lib/python3.7/site-packages/click/termui.py", line 374, in style
raise TypeError('Unknown color %r' % fg)
TypeError: Unknown color 'bright_green'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/bin/flake8", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/flake8/main/cli.py", line 18, in main
app.run(argv)
File "/usr/local/lib/python3.7/site-packages/flake8/main/application.py", line 393, in run
self._run(argv)
File "/usr/local/lib/python3.7/site-packages/flake8/main/application.py", line 381, in _run
self.run_checks()
File "/usr/local/lib/python3.7/site-packages/flake8/main/application.py", line 300, in run_checks
self.file_checker_manager.run()
File "/usr/local/lib/python3.7/site-packages/flake8/checker.py", line 329, in run
self.run_parallel()
File "/usr/local/lib/python3.7/site-packages/flake8/checker.py", line 293, in run_parallel
for ret in pool_map:
File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
return (item for chunk in result for item in chunk)
File "/usr/local/lib/python3.7/multiprocessing/pool.py", line 748, in next
raise value
TypeError: Unknown color 'bright_green'
Dependabot couldn't fetch one or more of your project's path-based Python dependencies. The affected dependencies were docs/setup.py
.
To use path-based dependencies with Dependabot the paths must be relative and resolve to a directory in this project's source code.
You can mention @dependabot in the comments below to contact the Dependabot team.
1:1 NIP102 None of those Python files was found in the root dir /home/travis/build/wemake-services/wemake-python-styleguide/docs: setup.py, autoapp.py
# -*- coding: utf-8 -*-
^
Source: wemake-services/wemake-python-styleguide#760
CI: https://travis-ci.org/wemake-services/wemake-python-styleguide/jobs/571009091
I am not sure what's going on.
It also does not happen locally.
I expect 'nitpick' to complete in few minutes
I get endless completion time.
I think it's happens because of behaviour of Path().root and Path().parent on windows
>>> Path('c:/')
WindowsPath('c:/')
>>> Path('c:/').root
'\\'
>>> Path('c:/').parent
WindowsPath('c:/')
flake8
nitpick
version used: 0.21.1
Python version: Python 3.7.4
Operating System and version: Windows 10
Run the following commands and paste the output:
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>where python
C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\python.exe
C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\python.exe
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>python -V
Python 3.7.4
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>pip freeze
altgraph==0.16.1
astor==0.8.0
atomicwrites==1.3.0
attrs==19.2.0
bandit==1.6.2
certifi==2019.9.11
chardet==3.0.4
Click==7.0
colorama==0.3.9
dictdiffer==0.8.0
docutils==0.15.2
entrypoints==0.3
eradicate==1.0
flake8==3.7.8
flake8-annotations-complexity==0.0.2
flake8-bandit==2.1.2
flake8-broken-line==0.1.1
flake8-bugbear==19.8.0
flake8-builtins==1.4.1
flake8-coding==1.3.2
flake8-commas==2.0.0
flake8-comprehensions==2.2.0
flake8-debugger==3.1.1
flake8-docstrings==1.5.0
flake8-eradicate==0.2.2
flake8-executable==2.0.3
flake8-isort==2.7.0
flake8-logging-format==0.6.0
flake8-pep3101==1.2.1
flake8-polyfill==1.0.2
flake8-print==3.1.1
flake8-quotes==2.1.0
flake8-rst-docstrings==0.0.11
flake8-string-format==0.2.3
future==0.18.0
gitdb2==2.0.6
GitPython==3.0.3
idna==2.8
importlib-metadata==0.23
isort==4.3.21
jmespath==0.9.4
mando==0.6.4
marshmallow==3.2.1
marshmallow-polyfield==5.7
mccabe==0.6.1
more-itertools==7.2.0
nitpick==0.21.1
packaging==19.2
pbr==5.4.3
pefile==2019.4.18
pep8-naming==0.8.2
pluggy==0.13.0
py==1.8.0
pycodestyle==2.5.0
pydocstyle==4.0.1
pyflakes==2.1.1
Pygments==2.4.2
PyInstaller==3.5
pyparsing==2.4.2
pytest==5.2.1
python-slugify==3.0.6
pywin32-ctypes==0.2.0
PyYAML==5.1.2
radon==2.4.0
requests==2.22.0
restructuredtext-lint==1.3.0
ruamel.yaml==0.16.5
ruamel.yaml.clib==0.2.0
six==1.12.0
smmap2==2.0.5
snowballstemmer==2.0.0
sortedcontainers==2.1.0
stevedore==1.31.0
testfixtures==6.10.0
text-unidecode==1.3
toml==0.10.0
typing-extensions==3.7.4
urllib3==1.25.6
wcwidth==0.1.7
wemake-python-styleguide==0.12.5
zipp==0.6.0
I expect that pre-commit
won't be mentioned in nitpick
reports. Because I don't use it and I don't have references of it in my style files.
nitpick
reports about missing key in .pre-commit-config.yaml
. Why?
Link to the CI: https://travis-ci.org/wemake-services/wemake-django-template/builds/586597805#L793
Link to the source code: https://github.com/wemake-services/wemake-django-template/blob/f108ed5aae4b88006f61d8cfa215f3f3699d1509/%7B%7Bcookiecutter.project_name%7D%7D/pyproject.toml#L7
Link to the styles/
folder: https://github.com/wemake-services/wemake-python-styleguide/blob/master/styles
Enforce the use of tox with a certain configuration.
The file is not being checked.
This is an old solution, not valid/needed anymore with the plugin system:
# Or IniFile or ConfigParserIni as the parent class,
# depending on the format used by tox
class ToxIni(BaseFile):
Different values on hooks' keys should also trigger flake8 errors.
Only the presence of the hook is checked, by its id
value.
If any of the values on .pre-commit-config.yaml
is different from the style file, no error is raised.
Find a better way to store partial YAML configuration on the nitpick style.
Right now it's better to store it as a multiline YAML partial string.
It's easier to just copy and paste from a real YAML file.
And this string is not 100% valid YAML, because it is just a "slice" of a YAML file.
YAML is converted to a dict
internally, but storing it in the TOML file would be really ugly for the human eye.
And people would just need to convert YAML to dict
, then put in the style .toml file... not practical at all.
Maybe considering the indentation in the style file as a starting point to determine the nesting level of the YAML.
E.g: 2 spaces in the front mean those keys are below another level.
# The original YAML has a parent key here at this level
- some_nested_key:
- item 1
- item 2
- another_nested_key:
- item 3
- item 4
E.g: 4 spaces in the front mean those keys are 2 levels deep.
# The original YAML has a parent key here at this level
# There is yet another child here
- some_nested_key:
- item 1
- item 2
- another_nested_key:
- item 3
- item 4
In my style file
["setup.cfg".flake8]
ignore = "W503,E203,FI58,PT003,C408"
exclude = "venv*,**/migrations/"
per-file-ignores = "tests/**.py:FI18,setup.py:FI18"
[nitpick.files."setup.cfg"]
comma_separated_values = ["flake8.ignore", "flake8.exclude", "falek8.per-file-ignores"]
and setup.cfg
[flake8]
exclude = venv*,**/migrations/
ignore = W503,E203,FI12,FI15,FI16,FI17,FI18,FI50,FI51,FI53,FI54,FI55,FI58,PT003,C408
per-file-ignores = tests/**.py:FI18,setup.py:FI18,tests/**.py:BZ01
When I run flake8 .
I expect to there are no error but flake8 blame me like below.
./tests/__init__.py:0:1: NIP323 File setup.cfg: [flake8]per-file-ignores is tests/**.py:FI18,setup.py:FI18,tests/**.py:BZ01 but it should be like this:
[flake8]
per-file-ignores = tests/**.py:FI18,setup.py:FI18
Maybe fix parsing logic...?
setup.cfg
like aboveflake8 .
on root directorynitpick
version used: 0.23.1
Python version: 3.8 and 3.9 too
Operating System and version: macos 15
Link to your project: https://github.com/Buzzvil/buzzvil-python-styleguide
Run the following commands and paste the output:
/Users/isac.yoo/Library/Caches/pypoetry/virtualenvs/buzzvil-python-styleguide-wLohAt5O-py3.9/bin/python3
Python 3.9.0
appdirs @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/47/cf/4f/4ef02fb715aa36daeebad18cc5570126159c659c41c7b5ec46a7387d9b/appdirs-1.4.4-py2.py3-none-any.whl
attrs @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/fb/1a/c6/6103c773c75c58dfe3575697b2d5d9242f3c1abda90b6fae3b36cbcb0d/attrs-20.2.0-py2.py3-none-any.whl
black @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/56/00/d0/a3bee2cbd161f599bac7d8ee24fb2b17aeba39b53bc42724de21f352bf/black-20.8b1.tar.gz
certifi @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/21/05/56/449b96ff701697c4cc1601fdacb878ed935f7eac76b99971b346b8ef9d/certifi-2020.6.20-py2.py3-none-any.whl
chardet @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/8f/6f/1c/8085d730ad63c462222af30d0d01c4bd0caca5287e40b63c1fe8f529b7/chardet-3.0.4-py2.py3-none-any.whl
click @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/e2/79/34/a23e9d2f683ed66be11ec3bd760dec3a2fe228cfdedf2071bcf0531b06/click-7.1.2-py2.py3-none-any.whl
dictdiffer @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/89/cd/10/56605467e905287a1404203b6fd708ad810132b18fa01a03f5e2db6d5e/dictdiffer-0.8.1-py2.py3-none-any.whl
dlint @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/7b/62/45/b39111d9e2cb63b46494bde16cfe5ce049d58fe3f9cd9e7da6da8d35c7/dlint-0.11.0-py2.py3-none-any.whl
eradicate @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/12/ce/ac/197035fe6d51568abb7ea160f5ad416d2164a2010005e8356b8229e550/eradicate-2.0.0.tar.gz
flake8 @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/4f/88/2e/d38cf0f4194842739925b11c47e3143194778609f5ebc1997b71de0b21/flake8-3.8.4-py2.py3-none-any.whl
flake8-annotations-complexity @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/36/2a/8c/1480d6c411b2dcd6f7f452e31266b8b8bbe178c40823202f9fc3adca9f/flake8_annotations_complexity-0.0.5.tar.gz
flake8-black @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/28/43/3d/5bcd96af9b684c11984eb821e9c8355bd9268b844e366a15f53f5db0d5/flake8-black-0.2.1.tar.gz
flake8-blind-except @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/b4/80/6c/badab07a60249dad058845f23f2b3438b78c3b5786a3eaea9645172984/flake8-blind-except-0.1.1.tar.gz
flake8-bugbear @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/23/1d/31/0d3d3387d7003553b5a2a762c7cc46a5806152b2ffa1e7da9ea48ada9f/flake8_bugbear-20.1.4-py36.py37.py38-none-any.whl
flake8-builtins @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/21/84/db/7a82d055eb4c2280b774d4ce298b6ffed7bd8acffe0d03e5e6947dd310/flake8_builtins-1.5.3-py2.py3-none-any.whl
flake8-comprehensions @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/6b/7e/03/30d2bd99c7fb9c3925cbb25737d66b60f0cd2ed3d14899987c85acf17a/flake8_comprehensions-3.3.0-py3-none-any.whl
flake8-eradicate @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/99/8a/26/95fdb311c16f732e009ab3febcd098f7287b47ae77d547d51f8e69027e/flake8_eradicate-1.0.0-py3-none-any.whl
flake8-functions @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/d3/7a/ea/0e44a4cd55f27690dc2eaddb0519f629fedb548260057232749313fe4e/flake8_functions-0.0.4-py3-none-any.whl
flake8-future-import @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/88/6a/60/61ff387e9b81ff5dc12892134679999111e6a7294738c05256355a502f/flake8_future_import-0.4.6-py2.py3-none-any.whl
flake8-keyword-arguments @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/e8/6c/64/324505d15ce1f308813ffff573b5fdc47bfb2f12ce3588fc7bdfe6bc4a/flake8_keyword_arguments-0.1.0-py3-none-any.whl
flake8-mutable @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/0b/5f/b4/e198dacfee1e44f05fa19150e4e2abeee61f823b172dc47803810ae379/flake8-mutable-1.2.0.tar.gz
flake8-plugin-utils @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/05/01/93/d85d5e280ed56eaf6400f1215ca97460ff0d1aca89497cfc6a770d5b91/flake8_plugin_utils-1.3.1-py3-none-any.whl
flake8-polyfill @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/28/17/cc/952c11cd5ffb2608137557f928dc4f9365b4dbe1e2a6015eeea78583ac/flake8_polyfill-1.0.2-py2.py3-none-any.whl
flake8-pytest-style @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/cd/d6/4c/22ac1d44114fd037192385dca5364fc4f9e7671f4fb1d907b0aa7cf28d/flake8_pytest_style-1.3.0-py3-none-any.whl
identify @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/ef/35/b1/9305ae6b813bce6ef58234803083ead07b2b7b28e03a08c18a6c3dcc3e/identify-1.5.9-py2.py3-none-any.whl
idna @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/ef/7f/a9/19cc0b8760bdf6f696290c06532496f8bb29fbdaad044f852fed00ec82/idna-2.10-py2.py3-none-any.whl
iniconfig @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/fa/b0/c6/10cfac68c9e6de9d2a1678366ca89fd9292b362c1760dbe758e41691cb/iniconfig-1.1.1-py2.py3-none-any.whl
jmespath @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/2c/f0/52/b0ba93d941bd49c8719dee7ca27d2096bf96e17948667388c3ee2ac8f8/jmespath-0.10.0-py2.py3-none-any.whl
marshmallow @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/96/b7/07/7de906958a6f35b490e21a970f5c665cf2662c4600d128b29ba046c4fd/marshmallow-3.9.0-py2.py3-none-any.whl
marshmallow-polyfield @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/11/46/19/129f4f42a2731df90af6d8cf8147dbf95a6a357c45a15bb2a6f3171004/marshmallow-polyfield-5.9.tar.gz
mccabe @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/96/5e/5f/21ae5296697ca7f94de4da6e21d4936d74029c352a35202e4c339a4253/mccabe-0.6.1-py2.py3-none-any.whl
more-itertools @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/7d/18/5b/12afd5e33694faf95db51e22aa54cfa3d1bafccb3829da451c61f5147a/more_itertools-8.6.0-py3-none-any.whl
mypy @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/27/70/0f/dedc216f4bb804889f12f78af571efe8280e5035b50e106e0d65409504/mypy-0.790-py3-none-any.whl
mypy-extensions @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/92/45/bf/1807ce854ff668d92602207a37bfa9316def2a3f257bd03c4c5be4bc9b/mypy_extensions-0.4.3-py2.py3-none-any.whl
nitpick @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/06/57/8e/f4addeef60b3d40e06d94c1339dc3a03672737f32116c0061bb4e524a2/nitpick-0.23.1-py3-none-any.whl
packaging @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/c2/db/fd/1c4b276e8eb8d548bc667eb79d0e46e6e0e33e016805c22b95e7a72836/packaging-20.4-py2.py3-none-any.whl
pathspec @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/e4/03/ac/1840dd6347740ddd832fbd2ce386491d30dfb418470eee2557cc4aff9b/pathspec-0.8.0-py2.py3-none-any.whl
pep8-naming @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/a4/93/c7/a3b9b8b4aef682b4caa67015d897aff3d064860a460124ad8a23b6f45f/pep8_naming-0.11.1-py2.py3-none-any.whl
pluggy @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/29/58/fc/ed8b7451d3ef91a6465024f5656141da996e7aafd4d41a1659629a75e7/pluggy-0.13.1-py2.py3-none-any.whl
py @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/8b/d2/99/c011698bd549f30497b27bee2731848753a014313ed783267c74b6dcde/py-1.9.0-py2.py3-none-any.whl
pycodestyle @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/00/8e/03/5dd26ed1283fc5849fa141c87a1d99659b252d7a2105d6ec509c6de6cd/pycodestyle-2.6.0-py2.py3-none-any.whl
pyflakes @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/c6/a2/76/8815e047ae91abaf39cdde4a16f52907ed96ae14e12a498dd0704cb43a/pyflakes-2.2.0-py2.py3-none-any.whl
pyparsing @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/92/0f/cf/effdcd5d76a6186df0969f85b3b030284ff8058936d5016540b5258ea3/pyparsing-2.4.7-py2.py3-none-any.whl
pytest @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/51/2b/69/0ed871e9892cd17ac62114915ee43c391fee90b73004344382be06b388/pytest-6.1.2-py3-none-any.whl
python-slugify @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/c7/a7/df/f5e1ea59556a505b43a42b5730c4db933dbde2f994747f2af3dd185fa1/python-slugify-4.0.1.tar.gz
regex @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/8e/c6/90/82166b2ff9a80d02be7cc554d160638e3656ac47245a253b8585591fb1/regex-2020.10.28-cp39-cp39-macosx_10_9_x86_64.whl
requests @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/c8/71/24/b6c0095afdab8413168a4547362ea8d0a5ea62f987aeab4491a614683e/requests-2.24.0-py2.py3-none-any.whl
ruamel.yaml @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/e3/77/60/c6e35eb5461cad7856f44e8108e59233a37c83041ce3e4055d79d42476/ruamel.yaml-0.16.12-py2.py3-none-any.whl
six @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/dd/1c/65/ad0dea11136f5a869f072890a0eea955aa8fc35b90c85c55249fd3abfe/six-1.15.0-py2.py3-none-any.whl
sortedcontainers @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/48/0f/c2/ded1564076c6d1cb40158163d236954eb9e5124e57d9be895219db8663/sortedcontainers-2.2.2-py2.py3-none-any.whl
text-unidecode @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/34/f9/c2/484c44b08bab89d472229bbd257fcc1d1c6273ee027f01cb08c4e3c309/text_unidecode-1.3-py2.py3-none-any.whl
toml @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/6b/6a/c9/53b19f7870a77d855e8b05ecdc98193944e5d246dafe11bbcad850ecba/toml-0.10.2-py2.py3-none-any.whl
typed-ast @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/31/2b/fd/ae2dba5a915c33575ab7e0fa78d5ce3ce6eee3c7657e00608d740175b8/typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl
typing-extensions @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/ab/c3/72/446cb2c521f10fc837619e8a7c68ed3c3bd74859bd625b7d74f38a159b/typing_extensions-3.7.4.3-py3-none-any.whl
urllib3 @ file:///Users/isac.yoo/Library/Caches/pypoetry/artifacts/d8/4b/3f/9e8027e7f15b2f99244ad505328c3cf87912ad87446c1c8e89efacf731/urllib3-1.25.11-py2.py3-none-any.whl
#!/Users/isac.yoo/Library/Caches/pypoetry/virtualenvs/buzzvil-python-styleguide-wLohAt5O-py3.9/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
» flake8 .
./tests/test_version.py
0:1 NIP001 File mypy.toml has an incorrect style. Invalid TOML:
TomlDecodeError: This float doesn't have a leading digit (line 2 column 1 char 19)
» flake8 .
./tests/test_version.py
1:1 NIP001 File mypy.toml has an incorrect style. Invalid TOML:
TomlDecodeError: This float doesn't have a leading digit (line 2 column 1 char 19)
# -*- coding: utf-8 -*-
^
When you report violations on line 0
they are not bound to any source line.
When you report violation on line 1
they are bound to the first line and since this moment --show-source
works incorrectly and report this part:
# -*- coding: utf-8 -*-
^
(This is my first line from ./tests/test_version.py
)
I would also like to highlight that ./tests/test_version.py
does not hav anything to do with the reported violation. It might create some interesting situations.
I know that flake8
has quite a strange violation reporting API, but can we consider reporting this violation on files like nitpick-style.toml
or similar?
I have this setting:
["setup.cfg".flake8]
ignore = "D100,D104,D401,W504,RST303,RST304"
And in my setup.cfg
I have the following:
[flake8]
# Exclude some pydoctest checks globally:
ignore = D100, D104, D401, W504, RST303, RST304
» flake8 .
./tests/test_version.py
0:1 NIP323 File setup.cfg: [flake8]ignore is D100, D104, D401, W504, RST303, RST304 but it should be like this:
[flake8]
ignore = D100,D104,D401,W504,RST303,RST304
That's not what I expect for several reasons:
D101
for example). Sometimes projects do have different ignore rules due to different legacy, plugins, reasons.Use code in ignore
check. All instances from the toml
file must be present.
We can have more items in setup.cfg
.
@andreoliwa what do you think?
After my update to [email protected]
nitpick stoped working.
(.venv) ~/Documents/github/returns master ✗ ✚
» poetry update
Updating dependencies
Resolving dependencies... (10.4s)
Writing lock file
Package operations: 0 installs, 12 updates, 1 removal
- Updating smmap (3.0.2 -> 3.0.4)
- Updating gitdb (4.0.4 -> 4.0.5)
- Updating pycodestyle (2.5.0 -> 2.6.0)
- Updating pyflakes (2.1.1 -> 2.2.0)
- Updating flake8 (3.7.9 -> 3.8.1)
- Updating gitpython (3.1.1 -> 3.1.2)
- Updating pytz (2019.3 -> 2020.1)
- Updating toml (0.10.0 -> 0.10.1)
- Updating marshmallow (3.5.1 -> 3.6.0)
- Updating click (7.1.1 -> 7.1.2)
- Updating darglint (1.2.3 -> 1.3.0)
- Updating jmespath (0.9.5 -> 0.10.0)
- Removing entrypoints (0.3)
(.venv) ~/Documents/github/returns master ✗ ✚
» flake8 .
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/sobolev/.pyenv/versions/3.7.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/Users/sobolev/.pyenv/versions/3.7.7/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
return list(map(*args))
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 664, in _run_checks
return checker.run_checks()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 598, in run_checks
self.run_ast_checks()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 505, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/plugin.py", line 52, in run
Nitpick.current_app().config.merge_styles(), self.check_files(True), self.check_files(False)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/config.py", line 65, in merge_styles
style.find_initial_styles(configured_styles)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 63, in find_initial_styles
self.include_multiple_styles(chosen_styles)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 99, in include_multiple_styles
self.include_multiple_styles(sub_styles)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/style.py", line 84, in include_multiple_styles
toml_dict = toml.as_data
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/formats.py", line 125, in as_data
self.load()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/nitpick/formats.py", line 226, in load
self._reformatted = toml.dumps(self._data)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/toml/encoder.py", line 67, in dumps
raise ValueError("Circular reference detected")
ValueError: Circular reference detected
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/sobolev/Documents/github/returns/.venv/bin/flake8", line 10, in <module>
sys.exit(main())
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 360, in run
self._run(argv)
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 348, in _run
self.run_checks()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/main/application.py", line 262, in run_checks
self.file_checker_manager.run()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 332, in run
self.run_parallel()
File "/Users/sobolev/Documents/github/returns/.venv/lib/python3.7/site-packages/flake8/checker.py", line 296, in run_parallel
for ret in pool_map:
File "/Users/sobolev/.pyenv/versions/3.7.7/lib/python3.7/multiprocessing/pool.py", line 354, in <genexpr>
return (item for chunk in result for item in chunk)
File "/Users/sobolev/.pyenv/versions/3.7.7/lib/python3.7/multiprocessing/pool.py", line 748, in next
raise value
ValueError: Circular reference detected
I would expect it to work as regular.
By the way, I don' have any issues to report in my project.
poetry update
flake8 .
nitpick
version used: 0.22.1
Python version: 3.7.7
Operating System and version: macos
Link to your project: https://github.com/dry-python/returns
Run the following commands and paste the output:
which python3
python3 -V
pip freeze
cat $(which flake8)
/Users/sobolev/Documents/github/returns/.venv/bin/python3
Python 3.7.7
WARNING: Could not find setup.py for directory /Users/sobolev/Documents/github/returns (tried all parent directories)
alabaster==0.7.12
anyio==1.3.0
astor==0.8.1
async-generator==1.10
attrs==19.3.0
Babel==2.8.0
bandit==1.6.2
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
coverage==5.1
curio==1.2
darglint==1.3.0
decorator==4.4.2
dictdiffer==0.8.1
doc8==0.8.0
docutils==0.16
dparse==0.5.1
eradicate==1.0
flake8==3.8.1
flake8-bandit==2.1.2
flake8-broken-line==0.2.0
flake8-bugbear==19.8.0
flake8-commas==2.0.0
flake8-comprehensions==3.2.2
flake8-debugger==3.2.1
flake8-docstrings==1.5.0
flake8-eradicate==0.3.0
flake8-isort==2.9.1
flake8-plugin-utils==1.3.0
flake8-polyfill==1.0.2
flake8-pyi==20.5.0
flake8-pytest-style==1.1.1
flake8-quotes==2.1.2
flake8-rst-docstrings==0.0.12
flake8-string-format==0.2.3
gitdb==4.0.5
GitPython==3.1.2
idna==2.9
imagesize==1.2.0
importlib-metadata==1.6.0
isort==4.3.21
Jinja2==2.11.2
jmespath==0.10.0
m2r==0.2.1
MarkupSafe==1.1.1
marshmallow==3.6.0
marshmallow-polyfield==5.9
mccabe==0.6.1
mistune==0.8.4
more-itertools==8.2.0
mypy==0.770
mypy-extensions==0.4.3
nitpick==0.22.1
outcome==1.0.1
packaging==20.3
pbr==5.4.5
pep8-naming==0.9.1
pluggy==0.13.1
py==1.8.1
pycodestyle==2.6.0
pydocstyle==5.0.2
pyflakes==2.2.0
Pygments==2.6.1
pyparsing==2.4.7
pytest==5.4.2
pytest-cov==2.8.1
pytest-mypy-plugins==1.3.0
pytest-randomly==3.3.1
pytest-subtests==0.3.0
python-slugify==4.0.0
pytz==2020.1
PyYAML==5.3.1
requests==2.23.0
restructuredtext-lint==1.3.0
-e git+https://github.com/dry-python/returns.git@bfd1ba4a7f34065cb05afe11836c4d7ee31691c1#egg=returns
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.0
safety==1.9.0
six==1.14.0
smmap==3.0.4
sniffio==1.1.0
snowballstemmer==2.0.0
sortedcontainers==2.1.0
Sphinx==2.4.4
sphinx-autodoc-typehints==1.10.3
sphinx-typlog-theme==0.8.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-mermaid==0.4.0
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
stevedore==1.32.0
testfixtures==6.14.1
text-unidecode==1.3
toml==0.10.1
tomlkit==0.6.0
trio==0.14.0
typed-ast==1.4.1
typing-extensions==3.7.4.2
urllib3==1.25.9
wcwidth==0.1.9
wemake-python-styleguide==0.14.0
zipp==3.1.0
#!/Users/sobolev/Documents/github/returns/.venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
Currently having to add multiple lines for the same file is a bit cumbersome:
[["requirements/test.txt".contains]]
line = "black"
[["requirements/test.txt".contains]]
line = "flake8"
[["requirements/test.txt".contains]]
line = "flake8-bandit"
I Would like to see the following option:
[["requirements/test.txt".contains]]
lines = ["black", "flake8", "flake8-bandit"]
This would be equivalent to the above lines
BTW: something to put in the documentation about this:
EDIT: I see this is not supported yet and the plugin assumes a single line. So add this to the desired feature:
toml
supports multiline strings so this is also a valid but not obvious usecase:
[["LICENSE".contains]]
line = """ Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
...
"""
I would expect a multiline string to also enforce the internal order unlike the lines example
Your bug may already be reported!
Please search on the issue tracker before creating one.
That's what I do:
poetry install
poetry add --dev nitpick
nitpick-style.toml
:# Default style file for nitpick
# https://raw.githubusercontent.com/andreoliwa/nitpick/v0.18.0/nitpick-style.toml
[nitpick]
minimum_version = "0.10.0"
["setup.cfg".flake8]
enable-extensions = "G"
flake8 .
that's what I get:» flake8 .
./tests/test_version.py
1:1 NIP312 File pyproject.toml should be deleted
# -*- coding: utf-8 -*-
^
Full list of violations and explanations:
https://wemake-python-stylegui.de/en/0.11.1/pages/usage/violations/
I am not sure why I should delete my pyproject.toml
🙂
Suggest a flake8 hook on the docs.
See pre-commit/pre-commit.com#353 (comment)
Nitpick has its own hook.
Remove .pre-commit-hooks.yaml
and change README and the docs.
Represent files that start with a dot on the style file.
TOML syntax does not allow keys starting with a dot.
The dot is not part of the key when writing the style, like in [["pre-commit-config.yaml".repos]]
.
Since this is a specific file, the plugin handles it and adds the dot.
But this won't work for generic files; specific handling would have to be done for specific files.
Using a dash in the beginning of the key to represent a dot.
Nitpick would replace a leading dash by a leading dot.
Examples of TOML sections:
[["-pre-commit-config.yaml".repos]]
[["-gitignore".contains]]
[["-dockerignore".contains]]
A dash is a valid first char for a TOML key, and I don't recall configuration files that start with a dash.
After this it will be possible to use generic dot files in the Nitpick style.
Add this section to pyproject.yml
[tool.nitpick]
style = [
"https://raw.githubusercontent.com/wemake-services/wemake-python-styleguide/master/styles/nitpick-style-wemake.toml",
"./nitpick.toml",
]
Running nitpick via flake8 should ensure that settings overridden in local nitpick.toml should be honoured.
I get an error
Traceback (most recent call last):
File "/Users/gghildyal/.pyenv/versions/cognito-3.8.3/bin/flake8", line 8, in <module>
sys.exit(main())
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/main/cli.py", line 22, in main
app.run(argv)
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/main/application.py", line 360, in run
self._run(argv)
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/main/application.py", line 348, in _run
self.run_checks()
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/main/application.py", line 262, in run_checks
self.file_checker_manager.run()
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/checker.py", line 325, in run
self.run_serial()
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/checker.py", line 309, in run_serial
checker.run_checks()
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/checker.py", line 589, in run_checks
self.run_ast_checks()
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/flake8/checker.py", line 496, in run_ast_checks
for (line_number, offset, text, _) in runner:
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/flake8.py", line 51, in run
yield from itertools.chain(app.config.merge_styles(), self.check_files(True), self.check_files(False))
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/config.py", line 66, in merge_styles
style.find_initial_styles(configured_styles)
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/style.py", line 66, in find_initial_styles
self.include_multiple_styles(chosen_styles)
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/style.py", line 92, in include_multiple_styles
style_path = self.get_style_path(style_uri) # type: Optional[Path]
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/style.py", line 121, in get_style_path
style_path = self.fetch_style_from_url(clean_style_uri)
File "/Users/gghildyal/.pyenv/versions/3.8.3/envs/cognito-3.8.3/lib/python3.8/site-packages/nitpick/style.py", line 162, in fetch_style_from_url
raise FileNotFoundError("Error {} fetching style URL {}".format(response, new_url))
FileNotFoundError: Error <Response [404]> fetching style URL https://raw.githubusercontent.com/wemake-services/wemake-python-styleguide/master/styles/./nitpick.toml
make: *** [lint] Error 1
As in summary above.
I am trying to use all styles from wemake-style-guide but increase the line length from 80 to 88. I am unable to do that at the moment.
nitpick
version used: 0.23
Python version: 3.8.3
Operating System and version: MacOS
Dependabot couldn't authenticate with https://pypi.python.org/simple/.
You can provide authentication details in your Dependabot dashboard by clicking into the account menu (in the top right) and selecting 'Config variables'.
Dependabot couldn't fetch one or more of your project's path-based Python dependencies. The affected dependencies were setup.py
.
To use path-based dependencies with Dependabot the paths must be relative and resolve to a directory in this project's source code.
Validate style files against schemas, to warn developers about wrong or extra/unnecessary data in the style.
This should help to detect configuration errors like #67.
Errors are raised when the style is invalid.
Use https://github.com/marshmallow-code/marshmallow/ schemas for:
[tool.nitpick]
section of pyproject.toml
;BaseFile
inherited classes.This validation should be the first thing executed, right after merging the style files into one.
For more information, see the CONTRIBUTING guide.
Check if one or more lines exist in a certain text file.
There is no such validation.
Accept a configuration like this:
[["requirements.txt".contains]]
line = "sphinx>=1.3.0"
Closes #162.
I expect nitpick
to download default style file.
I get Requests
exception about invalid url.
Traceback (most recent call last):
File "C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\flake8.exe\__main__.py", line 9, in <module>
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\cli.py", line 18, in main
app.run(argv)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 393, in run
self._run(argv)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 381, in _run
self.run_checks()
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\main\application.py", line 300, in run_checks
self.file_checker_manager.run()
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 331, in run
self.run_serial()
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 315, in run_serial
checker.run_checks()
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 598, in run_checks
self.run_ast_checks()
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\flake8\checker.py", line 502, in run_ast_checks
for (line_number, offset, text, check) in runner:
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\plugin.py", line 50, in run
Nitpick.current_app().config.merge_styles(), self.check_files(True), self.check_files(False)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\config.py", line 65, in merge_styles
style.find_initial_styles(configured_styles)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 61, in find_initial_styles
self.include_multiple_styles(chosen_styles)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 97, in include_multiple_styles
self.include_multiple_styles(sub_styles)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 76, in include_multiple_styles
style_path = self.get_style_path(style_uri) # type: Optional[Path]
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 105, in get_style_path
style_path = self.fetch_style_from_url(clean_style_uri)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\nitpick\style.py", line 134, in fetch_style_from_url
response = requests.get(new_url)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\sessions.py", line 519, in request
prep = self.prepare_request(req)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\sessions.py", line 462, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\models.py", line 313, in prepare
self.prepare_url(url, params)
File "c:\users\sleip\desktop\git\poe_gems_requirements\venv\lib\site-packages\requests\models.py", line 390, in prepare_url
raise InvalidURL("Invalid URL %r: No host supplied" % url)
requests.exceptions.InvalidURL: Invalid URL 'https:///C:\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37.toml': No host supplied
I think that problem is due to resolving domain_plus_url
in style.fetch_style_from_url
.
I don't understand why it's done for but it's looks like that problem can accure on Linux too.
>>> url = PosixPath('\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37')
>>> url.resolve()
PosixPath('/home/.anon-737a48732c124779a7a9e587/\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\
\styles\\python37')
>>> url = WindowsPath('\\raw.githubusercontent.com\\andreoliwa\\nitpick\\v0.21.2\\styles\\python37')
>>> url.resolve()
WindowsPath('C:/raw.githubusercontent.com/andreoliwa/nitpick/v0.21.2/styles/python37')
nitpick
version used: 0.21.2
Python version: Python 3.7.4
Operating System and version: Windows 10
Run the following commands and paste the output:
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>where python
C:\Users\Sleip\Desktop\Git\poe_gems_requirements\venv\Scripts\python.exe
C:\Users\Sleip\AppData\Local\Programs\Python\Python37-32\python.exe
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>python -V
Python 3.7.4
(venv) C:\Users\Sleip\Desktop\Git\poe_gems_requirements>pip freeze
altgraph==0.16.1
astor==0.8.0
atomicwrites==1.3.0
attrs==19.2.0
bandit==1.6.2
certifi==2019.9.11
chardet==3.0.4
Click==7.0
colorama==0.3.9
dictdiffer==0.8.0
docutils==0.15.2
entrypoints==0.3
eradicate==1.0
flake8==3.7.8
flake8-annotations-complexity==0.0.2
flake8-bandit==2.1.2
flake8-broken-line==0.1.1
flake8-bugbear==19.8.0
flake8-builtins==1.4.1
flake8-coding==1.3.2
flake8-commas==2.0.0
flake8-comprehensions==2.2.0
flake8-debugger==3.1.1
flake8-docstrings==1.5.0
flake8-eradicate==0.2.2
flake8-executable==2.0.3
flake8-isort==2.7.0
flake8-logging-format==0.6.0
flake8-pep3101==1.2.1
flake8-polyfill==1.0.2
flake8-print==3.1.1
flake8-quotes==2.1.0
flake8-rst-docstrings==0.0.11
flake8-string-format==0.2.3
future==0.18.0
gitdb2==2.0.6
GitPython==3.0.3
idna==2.8
importlib-metadata==0.23
isort==4.3.21
jmespath==0.9.4
mando==0.6.4
marshmallow==3.2.1
marshmallow-polyfield==5.7
mccabe==0.6.1
more-itertools==7.2.0
nitpick==0.21.2
packaging==19.2
pbr==5.4.3
pefile==2019.4.18
pep8-naming==0.8.2
pluggy==0.13.0
py==1.8.0
pycodestyle==2.5.0
pydocstyle==4.0.1
pyflakes==2.1.1
Pygments==2.4.2
PyInstaller==3.5
pyparsing==2.4.2
pytest==5.2.1
python-slugify==3.0.6
pywin32-ctypes==0.2.0
PyYAML==5.1.2
radon==2.4.0
requests==2.22.0
restructuredtext-lint==1.3.0
ruamel.yaml==0.16.5
ruamel.yaml.clib==0.2.0
six==1.12.0
smmap2==2.0.5
snowballstemmer==2.0.0
sortedcontainers==2.1.0
stevedore==1.31.0
testfixtures==6.10.0
text-unidecode==1.3
toml==0.10.0
typing-extensions==3.7.4
urllib3==1.25.6
wcwidth==0.1.7
wemake-python-styleguide==0.12.5
zipp==0.6.0
I expect everything to work correctly with 0.21
, the same way it was with 0.20
.
./docs/conf.py
0:1 NIP001 File .cache/nitpick/https-raw-githubusercontent-com-wemake-services-wemake-python-styleguide-master-styles-poetry-toml.toml has an incorrect style. Invalid config:
nitpick.files."pyproject.toml": Unknown file. See https://nitpick.rtfd.io/en/latest/nitpick_section.html#nitpick-files.
CI job: https://travis-ci.org/dry-python/returns/jobs/577166238
nitpick declaration: https://github.com/dry-python/returns/blob/master/pyproject.toml#L7
File poetry.toml
:
[nitpick.files."pyproject.toml"]
missing_message = "Install poetry and run 'poetry init' to create it"
I am not sure what's wrong.
Does not complain when a style file URL does not end with .toml
➜ flake8
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/Users/<user>/.pyenv/versions/3.7.5/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/checker.py", line 666, in _run_checks
return checker.run_checks()
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/checker.py", line 598, in run_checks
self.run_ast_checks()
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/checker.py", line 502, in run_ast_checks
for (line_number, offset, text, check) in runner:
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/plugin.py", line 50, in run
Nitpick.current_app().config.merge_styles(), self.check_files(True), self.check_files(False)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/config.py", line 65, in merge_styles
style.find_initial_styles(configured_styles)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/style.py", line 61, in find_initial_styles
self.include_multiple_styles(chosen_styles)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/style.py", line 76, in include_multiple_styles
style_path = self.get_style_path(style_uri) # type: Optional[Path]
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/style.py", line 105, in get_style_path
style_path = self.fetch_style_from_url(clean_style_uri)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/nitpick/style.py", line 132, in fetch_style_from_url
raise FileNotFoundError("Error {} fetching style URL {}".format(response, new_url))
FileNotFoundError: Error <Response [401]> fetching style URL https://gitlab.com/api/v4/snippets/1954943/raw.toml
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/<user>/.pyenv/versions/<venv>/bin/flake8", line 10, in <module>
sys.exit(main())
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/main/cli.py", line 18, in main
app.run(argv)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/main/application.py", line 393, in run
self._run(argv)
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/main/application.py", line 381, in _run
self.run_checks()
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/main/application.py", line 300, in run_checks
self.file_checker_manager.run()
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/checker.py", line 329, in run
self.run_parallel()
File "/Users/<user>/.pyenv/versions/3.7.5/envs/<venv>/lib/python3.7/site-packages/flake8/checker.py", line 293, in run_parallel
for ret in pool_map:
File "/Users/<user>/.pyenv/versions/3.7.5/lib/python3.7/multiprocessing/pool.py", line 748, in next
raise value
FileNotFoundError: Error <Response [401]> fetching style URL https://gitlab.com/api/v4/snippets/1954943/raw.toml<user>
Do not append .toml
to style file URL when fetching it.
[tool.nitpick] style =...
flake8
I was trying to use a GitLab snippet to store my config. GitLab snippets' URL do not change across edition but GitHub's do.
nitpick
version used: 0.21.4
Python version: 3.7.5
Operating System and version: macOS 10.14.6
nitpick
should pick-up on mismatching dependency versions in package.json
vs. its style definition.
nitpick does not report a problem.
nitpick displays a warning instead (though it is silenced by pre-commit
unless using the -v
flag):
WARNING:nitpick.formats:Unexpected case key=['devDependencies.semantic-release'] raw_expected=^15.13.0
(I did not dig too deep in the source for this.)
A very minimal example can be seen in the gist b8c9888c.
poetry install
poetry run flake8
We want to bump semantic-release
in our projects. Since we are enforcing consistency across projects with nitpick
, we are also using it to pin this JS tool (cf. example).
nitpick
version used: 0.22.1
Python version: 3.7.5
Operating System and version: GNU/Linux 4.19.0-9-amd64
in Debian Buster
Link to your project:
Run the following commands and paste the output:
which python3
python3 -V
pip freeze
cat $(which flake8)
/home/borjan/.cache/pypoetry/virtualenvs/test-gclK-b8T-py3.7/bin/python3
Python 3.7.5
attrs==19.3.0
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.2
dictdiffer==0.8.1
entrypoints==0.3
flake8==3.7.9
idna==2.9
jmespath==0.9.5
marshmallow==3.6.0
marshmallow-polyfield==5.9
mccabe==0.6.1
nitpick==0.22.1
pkg-resources==0.0.0
pycodestyle==2.5.0
pyflakes==2.1.1
python-slugify==4.0.0
requests==2.23.0
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.0
sortedcontainers==2.1.0
text-unidecode==1.3
toml==0.10.0
urllib3==1.25.9
#!/home/borjan/.cache/pypoetry/virtualenvs/test-gclK-b8T-py3.7/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
I want to enforce my file types and their configs on .editorconfig.
This is an old solution, not valid/needed anymore with the plugin system:
class ConfigParserIni(BaseFile):
pass
class EditorConfig(ConfigParserIni):
pass
# Also change the parent of the setup.cfg class
class SetupCfg(ConfigParserIni):
pass
.editorconfig
as an INI file.editorconfig
as a default styleYour bug may already be reported!
Please search on the issue tracker before creating one.
The app should not break with an Exception on invalid TOML.
Stack trace with toml.decoder.TomlDecodeError
.
The developer should get a message "Style file XXX.toml has invalid TOML formatting: ".
Style file:
["setup.cfg".flake8]
ignore = D100,D104,D202,E203,W503
# raises toml.decoder.TomlDecodeError: This float doesn't have a leading digit (line 7 column 1 char 110)
extend-select = E241,C,E,F,W,B,B9
# raises toml.decoder.TomlDecodeError: This float doesn't have a leading digit (line 8 column 1 char 146)
foo = 1,2,3
# raises toml.decoder.TomlDecodeError: invalid literal for int() with base 0: '1,2,3' (line 9 column 1 char 182)
nitpick
version used: 0.16.1
Python version: 3.7.4
Operating System and version: macOS 10.14.5 (18F132)
Link to your project:
Run the following commands and paste the output:
which python3
python3 -V
pip freeze
cat $(which flake8)
~ which python3
/Users/andreoliwa/my_envs/nitpick_bug/bin/python3
~ python3 -V
Python 3.7.4
~ pip freeze
attrs==19.1.0
certifi==2019.6.16
chardet==3.0.4
dictdiffer==0.8.0
entrypoints==0.3
flake8==3.7.8
idna==2.8
jmespath==0.9.4
mccabe==0.6.1
nitpick==0.16.1
pycodestyle==2.5.0
pyflakes==2.1.1
python-slugify==3.0.3
requests==2.22.0
ruamel.yaml==0.16.0
ruamel.yaml.clib==0.1.0
sortedcontainers==2.1.0
text-unidecode==1.2
toml==0.10.0
urllib3==1.25.3
~ cat $(which flake8)
#!/Users/andreoliwa/my_envs/nitpick_bug/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
~
For more information, see the CONTRIBUTING guide.
After installing Nitpick 0.16.1 via pip install nitpick
and then invoking flake8
, the following error is returned:
> flake8
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 470, in _handle_results
task = get()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/connection.py", line 251, in recv
return _ForkingPickler.loads(buf.getbuffer())
TypeError: __init__() missing 2 required positional arguments: 'doc' and 'pos'
Uninstalling Nitpick resolves the problem and restores flake8
to its normal behavior.
[tool.nitpick]
style = [
"~/Projects/dotfiles/python/styles.toml",
]
~/Projects/dotfiles/python/styles.toml
["pyproject.toml".tool.black]
line-length = 85
["setup.cfg".flake8]
max-line-length = 85
max-complexity = 12
ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,E203,W503
select = E241,C,E,F,W,B,B9
["setup.cfg"]
comma_separated_values = ["flake8.ignore", "flake8.exclude"]
nitpick
version used: 0.16.1When referring to remote (possibly immutable) styles, a caching mechanism would be really helpful to 1) lower the resolution time and 2) allow for offline evaluation.
Note: this is different from an "offline mode" as requested in #129 in the sense that it is orthogonal. It does not matter if you are connected or not, the cache gets hit first and the resolution stops there if the cache is not invalidated. nitpick
is then run normally.
The remote styles are downloaded every time nitpick is invoked.
A new key cache
defined in the tool configuration:
[tool.nitpick]
section in pyproject.toml
;[nitpick]
section in nitpick-style.toml
, when pyproject.toml
is absent.The cache key would support the following values:
never
: Never cache, the style file(s) are always looked-up.forever
: Once the style(s) are cached, they never expire.n > 0
: the cache expires after n
seconds (or minutes, or hours, or days).The cached styles would live in the cache directory, keyed by the hash of their URI.
Individual styles would not be cached, only the resulting generated style (that is currently living in the cache directory by the way).
Keying by URI allows to handle immutable styles painlessly.
We are referring styles from our public GitHub repo directly (through git sha-1 for now, later through releases or signed tags).
The point is that we do not want to rely on local checkouts (e.g. for CI) and pointing to a stable URI that features an immutable content seems like a better idea.
The problem with GitHub raw data is that even though the content is immutable by definition, the HTTP headers are not really helping: they return a TTL of 5 minutes.
Caching based on the HTTP headers would be an improvement over no caching, but in the use-case I described, far from optimal. Manually setting the cache to never expire would be the best solution.
Considering caching is a hard problem, I suppose I oversaw many cases. I am particularly wary about caching for a finite amount of time. I think that part would be the hardest one, also because of the platform support that might be missing.
Can be install [email protected] with [email protected]
[SolverProblemError]
Because no versions of nitpick match >0.22.2,<0.23.0
and nitpick (0.22.2) depends on toml (<0.10.1), nitpick (>=0.22.2,<0.23.0) requires toml (<0.10.1).
And because black (20.8b1) depends on toml (>=0.10.1)
and no versions of black match >20.8b1,<21.0, nitpick (>=0.22.2,<0.23.0) is incompatible with black (>=20.8b1,<21.0).
So, because buzzvil-python-styleguide depends on both black (^20.8b1) and nitpick (^0.22.2), version solving failed.
Upgrade minimum version of toml
poetry add --dev nitpick
poetry add --dev black
nitpick
version used: 0.22.2
Python version: 3.8.5
Operating System and version: macOS 10.15.6
Link to your project: local project
Run the following commands and paste the output:
/usr/local/bin/python3
Python 3.8.5
aiohttp==3.6.2
async-timeout==3.0.1
attrs==19.3.0
Automat==20.2.0
cffi==1.14.0
chardet==3.0.4
constantly==15.1.0
cryptography==2.9.2
deluge==2.0.3
hyperlink==19.0.0
idna==2.9
incremental==17.5.0
Mako==1.1.3
MarkupSafe==1.1.1
multidict==4.7.6
Pillow==7.2.0
protobuf==3.13.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycairo==1.19.1
pycparser==2.20
PyGObject==3.36.1
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pyxdg==0.26
rencode==1.0.6
service-identity==18.1.0
setproctitle==1.1.10
six==1.15.0
Twisted==20.3.0
yarl==1.4.2
zope.interface==5.1.0
#!/usr/local/opt/python/bin/python3.7
# -*- coding: utf-8 -*-
import re
import sys
from flake8.main.cli import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
.pylintrc
and its values..pylintrc
is not being checked.
This is an old solution, not valid/needed anymore with the plugin system:
class PylintRcFile(BaseFile):
nitpick/src/nitpick/schemas.py
Line 88 in dd38fd3
Unknown file. See https://nitpick.rtfd.io/en/latest/config_files.html.
Check Travis CI configuration on .travis.yml
.
Warn about missing and different keys.
The file is not being checked.
# To reuse common YAML code
class YamlFile(BaseFile):
pass
class TravisYml(YamlFile):
pass
# Also change the parent class for pre-commit
class PreCommitFile(YamlFile):
pass
E.g.: Travis config should always contain some data like this:
script:
- safety check
install:
- pip install safety
Hi!
Your default styles for different python versions are invalid.
Let's dig into it!
For example, python35-36-37-38
style is defined as "^3.5 || ^3.6 || ^3.7 || ^3.8"
https://github.com/andreoliwa/nitpick/blob/develop/styles/python35-36-37-38.toml#L2
But, ^3.5
is expanded into >=3.5,<4
. So other boolean conditions are not needed.
The same with other styles for other python versions.
Dependabot couldn't fetch one or more of your project's path-based Python dependencies. The affected dependencies were setup.py
.
To use path-based dependencies with Dependabot the paths must be relative and resolve to a directory in this project's source code.
Configure the style with the keys that should not exist in pyproject.toml
, setup.cfg
and other files.
Right now flake8-nitpick
only checks if keys and values are present in config files.
Sometimes we want to enforce that some keys/values are not present in those files.
class BaseFile(...):
@abc.abstractmethod
def check_absent_values(self) -> YieldFlake8Error:
pass
Some examples:
pep257
, pycodestyle
should not be dependencies on pyproject.toml
(other flake8 plugins already take care of it);pur
should not be a dependency (poetry
replaces its need).Check if the order of the hooks on .pre-commit-config.yaml
is the same as defined on the style file.
Right now, only the presence of hooks is checked.
No idea.
You might want to execute faster hooks like black
and isort
before flake8
and mypy
, and even leave pylint
at last.
Is it possible with nitpick to enforce that requirements as specified in requirements.txt/setup.py/pyproject.toml match a certain version? To make sure all projects that use a share lib use a specific version?
I don't want to specify all dependencies only the ones that are reused over projects. Like shared libs, versions of flake8, pytest etc
Check ignore files like .gitignore
and .dockerignore
.
They are not being checked.
Use #165 to represent these ignore files, but #183 should be done first though.
This solution below is not valid anymore:
class IgnoreFile(BaseFile):
pass
class GitIgnore(IgnoreFile):
pass
class DockerIgnore(IgnoreFile):
pass
Similar to the "[nitpick.JSONFile]" section, arbitrary TOML, YAML, etc. files can have content enforcement.
With the notable exception of JSON files, there is a definitive list of supported files that one has to abide by.
Even though the formats are parsed and handled by nitpick, the files are not on the whitelist.
Rely on the filename extension to apply the format checker instead of using a whitelist.
We would like to enforce new configurations with nitpick:
Prettier can also parse a JSON configuration, but we would ideally not rewrite the configuration and open the door for more of our YAML files.
Not sure i misunderstood the out-of-the-box behavior of nitpick or there is a bug. I except that nitpick should report missing files when ran inside an empty project folder, and the default style file should be downloaded
In a folder, with poetry, pyproject.toml, and venv setup, install nitpick and run flake8:
In an empty folder, while running in a venv, install nitpick and run flake8:
Not sure if this is the correct behavior or my misinterpretation of nitpick's functionality/docs
nitpick
version used:0.21.3
Python version: 3.7
Operating System and version: macos
Run the following commands and paste the output:
Python 3.7.3
attrs==19.3.0
certifi==2019.11.28
chardet==3.0.4
Click==7.0
dictdiffer==0.8.1
entrypoints==0.3
flake8==3.7.9
idna==2.8
jmespath==0.9.4
marshmallow==3.4.0
marshmallow-polyfield==5.8
mccabe==0.6.1
nitpick==0.21.3
pycodestyle==2.5.0
pyflakes==2.1.1
python-slugify==4.0.0
requests==2.22.0
ruamel.yaml==0.16.10
ruamel.yaml.clib==0.2.0
sortedcontainers==2.1.0
text-unidecode==1.3
toml==0.10.0
urllib3==1.25.8
#~/.asdf/installs/python/3.7.3/bin/python3.7
import re
import sys
from flake8.main.cli import main
if name == 'main':
sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0])
sys.exit(main())
My current use-case is that I am working on pyproject.toml
styles.
I want
[build-system]
requires = ...
build-backend = ...
to be set to any values. But, I want them set.
Currently, I cannot find any ways to do this.
Related #10
According to a warning on the docs, pytest
config should not be on setup.cfg
.
Why forbid pytest.ini
also?
Because having only setup.cfg
and tox.ini
is enough (too many config files anyway).
No check for this.
No idea.
tool.nitpick.style
of pyproject.toml can load style which in some python package.
tool.nitpick.style
accept absolute file path or URL
some_python_package
src/some_python_package
├── __init__.py
├── plugin.py
├── plugin.pyi
├── py.typed
└── styles
├── black.toml
├── flake8.toml
├── mypy.toml
└── nitpick-style.toml
pyproject.toml
[tool.nitpick]
style = "pypackage://some_python_package.styles.nitpick-style.toml"
pyproject.toml
[tool.nitpick]
style = { module: "some_python_package.styles", resource: "nitpick-style.toml" }
My company has dozens of python projects. We have company wide flake8 rules and I want to share tool configurations across those projects with the flake8 rules. So I created a flake8 plugin and include nitpick-style.toml
. But because nitpick only accept pure file path, I can not reference the nitpick-style.toml
.
When running Nitpick, display the correct filenames that contain violations.
Simulate the output of a flake8
plugin, so warnings can be displayed together with tools that use the flake8
format.
If possible, display the correct line and column of the violation.
Also, without relying on flake8
, Nitpick can be used for any language, not only for Python projects.
There would be no need to create dummy.py
files.
Example output:
$ pre-commit run --all-files nitpick
Nitpick..................................................................Failed
- hook id: nitpick
- exit code: 1
.pre-commit-config.yaml:3:5: NIP339 hook 'debug-statements' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
.pre-commit-config.yaml:3:5: NIP339 hook 'end-of-file-fixer' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
.pre-commit-config.yaml:3:5: NIP339 hook 'trailing-whitespace' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
.pre-commit-config.yaml:9:5: NIP339 hook 'pyupgrade' (rev: v2.4.4) has different values. Use this:
rev: v2.4.1
.pre-commit-config.yaml:50:5: NIP339 hook 'flake8' (rev: 3.8.2) has different values. Use this:
rev: 3.8.1
setup.cfg:25:1: NIP324 section [flake8] has some missing key/value pairs. Use this:
[flake8]
exclude = .tox,build
pyproject.toml:55:1: NIP318 missing values:
[tool.poetry.dev-dependencies]
pylint = "*"
Nitpick is a flake8
plugin, and flake8
only runs on Python .py
files.
Currently, Nitpick chooses an arbitrary Python file and displays all the flake8
warnings as if they were violations of that Python file.
This was mentioned on #73 (comment)
Below is an example of how Nitpick works now.
All violations are displayed under docs/conf.py
, line 0, column 1.
$ pre-commit run --all-files nitpick
Nitpick..................................................................Failed
- hook id: nitpick
- exit code: 1
docs/conf.py:0:1: NIP339 File .pre-commit-config.yaml: hook 'debug-statements' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
docs/conf.py:0:1: NIP339 File .pre-commit-config.yaml: hook 'end-of-file-fixer' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
docs/conf.py:0:1: NIP339 File .pre-commit-config.yaml: hook 'trailing-whitespace' (rev: v3.1.0) has different values. Use this:
rev: v3.0.0
docs/conf.py:0:1: NIP339 File .pre-commit-config.yaml: hook 'pyupgrade' (rev: v2.4.4) has different values. Use this:
rev: v2.4.1
docs/conf.py:0:1: NIP339 File .pre-commit-config.yaml: hook 'flake8' (rev: 3.8.2) has different values. Use this:
rev: 3.8.1
docs/conf.py:0:1: NIP324 File setup.cfg: section [flake8] has some missing key/value pairs. Use this:
[flake8]
exclude = .tox,build
docs/conf.py:0:1: NIP318 File pyproject.toml has missing values:
[tool.poetry.dev-dependencies]
pylint = "*"
nitpick run
to check files.files
attribute on pre-commit.flake8
an optional dependency.poetry add --dev --extras flake8 nitpick
or pip install nitpick[flake8]
.The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.
Any Python project should always have a README.md
or README.rst
file.
And they might need certain content in it.
If the style file contains values for both files, raise a flake8 error as well ("Your style file contains rules for README.md and README.rst. Use only one of them").
Those files don't have a file checker for their content.
# Create parent classes to set the precedent to check even other .rst or .md files
class MarkdownFile(BaseFile):
pass
class RestructuredTextFile(BaseFile):
pass
class ReadmeMd(MarkdownFile):
pass
class ReadmeRst(RestructuredTextFile):
pass
Real world examples:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.