You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 = "*"
Current Behavior
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 = "*"
Possible Solution
Run a CLI command like nitpick run to check files.
Accept zero or more files as arguments.
Check only the desired files, of check all files if no arguments were provided.
This would make it compatible with the files attribute on pre-commit.
Make flake8 an optional dependency.
Nitpick would be installed with poetry add --dev --extras flake8 nitpick or pip install nitpick[flake8].
Try to parse the violated config file in order to determine the line and column of the violation.
The text was updated successfully, but these errors were encountered:
andreoliwa
changed the title
Display the correct filenames on violations, run Nitpick as a standalone CLI independent of flake8
Run as a standalone CLI independent of flake8 / display the correct filenames on violations
Feb 6, 2021
andreoliwa
changed the title
Run as a standalone CLI independent of flake8 / display the correct filenames on violations
CLI: Remove flake8 dependency, run with pre-commit
Feb 6, 2021
The tool is moving its way to being more language agnostic [1],
at least the flake8 configuration is now unnecessary.
For now, we still need the dummy Python files.
[1]: andreoliwa/nitpick#166
Expected Behavior
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 theflake8
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:
Current Behavior
Nitpick is a
flake8
plugin, andflake8
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.Possible Solution
nitpick run
to check files.Check only the desired files, of check all files if no arguments were provided.
This would make it compatible with the
files
attribute on pre-commit.flake8
an optional dependency.Nitpick would be installed with
poetry add --dev --extras flake8 nitpick
orpip install nitpick[flake8]
.The text was updated successfully, but these errors were encountered: