|
22 | 22 | among others. See https://github.com/sk-/git-lint for the complete list. |
23 | 23 |
|
24 | 24 | Usage: |
25 | | - git-lint [-f | --force] [--json] [--last-commit] [FILENAME ...] |
| 25 | + git-lint [-f | --force] [--json] [--last-commit] [--ignore=<fn>] [FILENAME ...] |
26 | 26 | git-lint [-t | --tracked] [-f | --force] [--json] [--last-commit] |
27 | 27 | git-lint -h | --version |
28 | 28 |
|
29 | 29 | Options: |
30 | | - -h Show the usage patterns. |
31 | | - --version Prints the version number. |
32 | | - -f --force Shows all the lines with problems. |
33 | | - -t --tracked Lints only tracked files. |
34 | | - --json Prints the result as a json string. Useful to use it in |
35 | | - conjunction with other tools. |
36 | | - --last-commit Checks the last checked-out commit. This is mostly useful |
37 | | - when used as: git checkout <revid>; git lint --last-commit. |
| 30 | + -h Show the usage patterns. |
| 31 | + --ignore=<files> List of files to ignore |
| 32 | + --version Prints the version number. |
| 33 | + -f --force Shows all the lines with problems. |
| 34 | + -t --tracked Lints only tracked files. |
| 35 | + --json Prints the result as a json string. Useful to use it in |
| 36 | + conjunction with other tools. |
| 37 | + --last-commit Checks the last checked-out commit. This is mostly useful |
| 38 | + when used as: git checkout <revid>; git lint --last-commit. |
38 | 39 | """ |
39 | 40 |
|
40 | 41 | from __future__ import unicode_literals |
@@ -190,6 +191,10 @@ def main(argv, stdout=sys.stdout, stderr=sys.stderr): |
190 | 191 | if arguments['--last-commit']: |
191 | 192 | commit = vcs.last_commit() |
192 | 193 |
|
| 194 | + ignore_paths = () |
| 195 | + if arguments['--ignore']: |
| 196 | + ignore_paths = tuple(arguments['--ignore'].split(',')) |
| 197 | + |
193 | 198 | if arguments['FILENAME']: |
194 | 199 | invalid_filenames = find_invalid_filenames(arguments['FILENAME'], |
195 | 200 | repository_root) |
@@ -217,7 +222,10 @@ def main(argv, stdout=sys.stdout, stderr=sys.stderr): |
217 | 222 | gitlint_config = get_config(repository_root) |
218 | 223 | json_result = {} |
219 | 224 |
|
220 | | - for filename in sorted(modified_files.keys()): |
| 225 | + target_filenames = modified_files.keys() if len(ignore_paths) < 1 |
| 226 | + else [x for x in modified_files.keys() |
| 227 | + if not os.path.relpath(x).startswith(ignore_paths)] |
| 228 | + for filename in sorted(target_filenames): |
221 | 229 | rel_filename = os.path.relpath(filename) |
222 | 230 | if not json_output: |
223 | 231 | stdout.write('Linting file: %s%s' % |
|
0 commit comments