|
1 | 1 | # https://pre-commit.com/#creating-new-hooks |
| 2 | + |
| 3 | +# This is the new default: to fix all files, NOT passing filenames to the hook. |
| 4 | +# The usage of "pass_filenames: false`` is not recommended by the authors of pre-commit, |
| 5 | +# but it's the only way to make Nitpick work as intended. |
| 6 | +# See this comment for more context: https://github.com/andreoliwa/nitpick/pull/673/files#r1714086075 |
| 7 | +# If this breaks your workflow, choose one of the other hooks below with "pass_filenames: true". |
| 8 | + |
2 | 9 | - id: nitpick |
3 | | - name: "nitpick fix (auto fixing files)" |
4 | | - description: "Fix configuration files (TOML/INI/JSON/etc.) directly, according to the Nitpick style" |
| 10 | + name: "nitpick fix (all files)" |
| 11 | + description: "Fix configuration files (TOML/INI/JSON/etc.) directly, according to the Nitpick style. All files are considered by pre-commit." |
5 | 12 | entry: nitpick fix |
| 13 | + pass_filenames: false |
6 | 14 | language: python |
7 | 15 |
|
8 | | -- id: nitpick-suggest |
9 | | - name: "nitpick init --suggest (auto fixing files)" |
10 | | - description: "Suggest new Nitpick styles based on the files in the project root (skipping Git ignored files)" |
11 | | - entry: nitpick init --fix --suggest |
12 | | - language: python |
13 | | - # This hook should NOT be run for changed Git files, otherwise they will be considered style URLS |
14 | | - # and will be added to [tool.nitpick]style in pyproject.toml |
| 16 | +# Same as nitpick, but with a more explicit name. |
| 17 | +- id: nitpick-fix-all |
| 18 | + name: "nitpick fix (all files)" |
| 19 | + description: "Fix configuration files (TOML/INI/JSON/etc.) directly, according to the Nitpick style. All files are considered by pre-commit." |
| 20 | + entry: nitpick fix |
15 | 21 | pass_filenames: false |
16 | | - always_run: true |
| 22 | + language: python |
17 | 23 |
|
18 | | -# This hook is kept for compatibility (or if one wants to be explicit): "nitpick" does the same as "nitpick-fix" now |
19 | 24 | - id: nitpick-fix |
20 | | - name: "nitpick fix (auto fixing files)" |
21 | | - description: "Fix configuration files (TOML/INI/JSON/etc.) directly, according to the Nitpick style" |
| 25 | + name: "nitpick fix (modified files only)" |
| 26 | + description: "Fix configuration files (TOML/INI/JSON/etc.) directly, according to the Nitpick style. Only modified files are considered by pre-commit." |
22 | 27 | entry: nitpick fix |
| 28 | + pass_filenames: true |
| 29 | + language: python |
| 30 | + |
| 31 | +- id: nitpick-check-all |
| 32 | + name: "nitpick check (all files)" |
| 33 | + description: "Only check configuration files (TOML/INI/JSON/etc.) and print the violations, according to the Nitpick style. All files are considered by pre-commit." |
| 34 | + entry: nitpick check |
| 35 | + pass_filenames: false |
23 | 36 | language: python |
24 | 37 |
|
25 | 38 | - id: nitpick-check |
26 | | - name: "nitpick check (check files only)" |
27 | | - description: "Only check configuration files (TOML/INI/JSON/etc.) and print the violations, according to the Nitpick style" |
| 39 | + name: "nitpick check (modified files only)" |
| 40 | + description: "Only check configuration files (TOML/INI/JSON/etc.) and print the violations, according to the Nitpick style. Only modified files are considered by pre-commit." |
28 | 41 | entry: nitpick check |
| 42 | + pass_filenames: true |
29 | 43 | language: python |
| 44 | + |
| 45 | +- id: nitpick-suggest |
| 46 | + name: "nitpick init --suggest (auto fixing files)" |
| 47 | + description: "Suggest new Nitpick styles based on the files in the project root (skipping Git ignored files)" |
| 48 | + entry: nitpick init --fix --suggest |
| 49 | + language: python |
| 50 | + # This hook should NOT be run for changed Git files, otherwise they will be considered style URLS |
| 51 | + # and will be added to [tool.nitpick]style in pyproject.toml |
| 52 | + pass_filenames: false |
| 53 | + always_run: true |
0 commit comments