-
-
Notifications
You must be signed in to change notification settings - Fork 24
Description
I've been staring at the docs that mention that one could lint INI-files here https://nitpick.readthedocs.io/en/latest/plugins.html#ini-files with a few hardcoded examples of such files. I tried applying it to .flake8 and .pylintrc and it worked. But when I did the same for .isort.cfg, nitpick just spit out this:
nitpick-style.toml:1: NIP001 has an incorrect style. Invalid config:
".isort.cfg".settings: Unknown configuration. See https://nitpick.rtfd.io/en/latest/plugins.html#text-files.I wondered why it'd identify this file as just a text file when it's clearly parseable with cfgparser. Grepping for hardcoded file names recognized as INI didn't help but staring at https://github.com/andreoliwa/nitpick/blob/develop/src/nitpick/plugins/ini.py did. I was lucky to notice identify in the var names even though it wasn't directly imported in that module. This is because I happen to know what that project is.
I quickly confirmed my suspicion with
$ identify-cli .flake8
["file", "flake8", "ini", "non-executable", "text"]
$ identify-cli .isort.cfg
["file", "non-executable", "text"]So I've gone ahead and submitted this PR upstream at pre-commit/identify#323.
While that patch will address the immediate problem, I felt like this issue needed to be filed anyway because this situation reveals problems in nitpick itself too.
I think that there are 2 possible action items (non-exclusive):
- mention that
identifyis used in the docs and suggest the users to submit PRs there to add new file classifications - implement a config setting in
nitpickitself allowing the end-users to specify that some specific file is of a specific (known to them) type and should be linted with a certain plugin
I hope this story provides all the necessary details to be actionable :)
Metadata
Metadata
Assignees
Labels
Projects
Status