Skip to content

Commit 212a36a

Browse files
authored
feat: add MegaLinter plugin (#476)
This makes it possible to run nitpick as a [MegaLinter](https://megalinter.github.io/) step.
1 parent 2c6bcd9 commit 212a36a

File tree

5 files changed

+60
-0
lines changed

5 files changed

+60
-0
lines changed

.bumpversion.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ replace = version = "{new_version}"
3434
[bumpversion:file:src/nitpick/__init__.py]
3535
search = __version__ = "{current_version}"
3636
replace = __version__ = "{new_version}"
37+
38+
[bumpversion:file:mega-linter-plugin-nitpick/nitpick.megalinter-descriptor.yml]
39+
search = {current_version}
40+
replace = {new_version}

README.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,19 @@ If you want to run Nitpick as a flake8 plugin instead::
393393
- id: flake8
394394
additional_dependencies: [nitpick]
395395

396+
Run as a MegaLinter plugin
397+
~~~~~~~~~~~~~~~~~~~~~~~~~~
398+
399+
If you use `MegaLinter <https://megalinter.github.io/>`_ you can run Nitpick as a plugin. Add the following two entries to your ``.mega-linter.yml`` configuration file:
400+
401+
.. code-block:: yaml
402+
403+
PLUGINS:
404+
- https://raw.githubusercontent.com/andreoliwa/nitpick/v0.32.0/mega-linter-plugin-nitpick/nitpick.megalinter-descriptor.yml
405+
ENABLE_LINTERS:
406+
- NITPICK
407+
408+
396409
More information
397410
----------------
398411

docs/quickstart.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ To start checking all your code against the default rules:
9292
9393
pre-commit run --all-files
9494
95+
Run as a MegaLinter plugin
96+
---------------------------
97+
98+
If you use `MegaLinter <https://megalinter.github.io/>`_ you can run Nitpick as a plugin. Add the following two entries to your ``.mega-linter.yml`` configuration file:
99+
100+
.. code-block:: yaml
101+
102+
PLUGINS:
103+
- https://raw.githubusercontent.com/andreoliwa/nitpick/v0.32.0/mega-linter-plugin-nitpick/nitpick.megalinter-descriptor.yml
104+
ENABLE_LINTERS:
105+
- NITPICK
106+
95107
Modify files directly
96108
---------------------
97109

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
descriptor_id: NITPICK
2+
descriptor_type: tooling_format
3+
descriptor_flavors:
4+
- all_flavors
5+
file_extensions:
6+
- "*"
7+
active_only_if_file_found:
8+
- ".nitpick.toml"
9+
- "pyproject.toml"
10+
linters:
11+
- linter_name: nitpick
12+
linter_url: https://nitpick.readthedocs.io/
13+
name: NITPICK
14+
install:
15+
dockerfile:
16+
- RUN pip install nitpick==0.32.0
17+
examples:
18+
- "nitpick check"
19+
- "nitpick fix"
20+
cli_help_arg_name: --help
21+
cli_lint_mode: project
22+
cli_lint_errors_count: regex_sum
23+
cli_lint_errors_regex: "Violations:.*([0-9]+)"
24+
cli_lint_extra_args:
25+
- "check"
26+
cli_lint_fix_arg_name: "fix"
27+
cli_lint_fix_remove_args:
28+
- "check"
29+
cli_lint_extra_args_after:
30+
- "--verbose"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"docs/conf.py",
3434
"docs/configuration.rst",
3535
"docs/quickstart.rst",
36+
"mega-linter-plugin-nitpick/nitpick.megalinter-descriptor.yml",
3637
"nitpick-style.toml",
3738
"package.json",
3839
"pyproject.toml",

0 commit comments

Comments
 (0)