mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-06 20:16:53 +00:00
Add forbid-new-submodules to hooks.yaml
This commit is contained in:
parent
7bcb6a92bf
commit
4b928ab06b
4 changed files with 10 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ Add this to your `.pre-commit-config.yaml`
|
||||||
- `fix-encoding-pragma` - Add `# -*- coding: utf-8 -*-` to the top of python files.
|
- `fix-encoding-pragma` - Add `# -*- coding: utf-8 -*-` to the top of python files.
|
||||||
- To remove the coding pragma pass `--remove` (useful in a python3-only codebase)
|
- To remove the coding pragma pass `--remove` (useful in a python3-only codebase)
|
||||||
- `flake8` - Run flake8 on your python files.
|
- `flake8` - Run flake8 on your python files.
|
||||||
|
- `forbid-new-submodules` - Prevent addition of new git submodules.
|
||||||
- `name-tests-test` - Assert that files in tests/ end in `_test.py`.
|
- `name-tests-test` - Assert that files in tests/ end in `_test.py`.
|
||||||
- Use `args: ['--django']` to match `test*.py` instead.
|
- Use `args: ['--django']` to match `test*.py` instead.
|
||||||
- `pyflakes` - Run pyflakes on your python files.
|
- `pyflakes` - Run pyflakes on your python files.
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,12 @@
|
||||||
entry: flake8
|
entry: flake8
|
||||||
language: python
|
language: python
|
||||||
files: \.py$
|
files: \.py$
|
||||||
|
- id: forbid-new-submodules
|
||||||
|
name: Forbid new submodules
|
||||||
|
language: python
|
||||||
|
entry: forbid-new-submodules
|
||||||
|
description: Prevent addition of new git submodules
|
||||||
|
files: ''
|
||||||
- id: name-tests-test
|
- id: name-tests-test
|
||||||
name: Tests should end in _test.py
|
name: Tests should end in _test.py
|
||||||
description: This verifies that test files are named correctly
|
description: This verifies that test files are named correctly
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from pre_commit_hooks.util import cmd_output
|
from pre_commit_hooks.util import cmd_output
|
||||||
|
|
@ -19,6 +20,7 @@ def main(argv=None):
|
||||||
retv = 1
|
retv = 1
|
||||||
|
|
||||||
if retv:
|
if retv:
|
||||||
|
print()
|
||||||
print('This commit introduces new submodules.')
|
print('This commit introduces new submodules.')
|
||||||
print('Did you unintentionally `git add .`?')
|
print('Did you unintentionally `git add .`?')
|
||||||
print('To fix: git rm {thesubmodule} # no trailing slash')
|
print('To fix: git rm {thesubmodule} # no trailing slash')
|
||||||
|
|
|
||||||
1
setup.py
1
setup.py
|
|
@ -52,6 +52,7 @@ setup(
|
||||||
'double-quote-string-fixer = pre_commit_hooks.string_fixer:main',
|
'double-quote-string-fixer = pre_commit_hooks.string_fixer:main',
|
||||||
'end-of-file-fixer = pre_commit_hooks.end_of_file_fixer:end_of_file_fixer',
|
'end-of-file-fixer = pre_commit_hooks.end_of_file_fixer:end_of_file_fixer',
|
||||||
'fix-encoding-pragma = pre_commit_hooks.fix_encoding_pragma:main',
|
'fix-encoding-pragma = pre_commit_hooks.fix_encoding_pragma:main',
|
||||||
|
'forbid-new-submodules = pre_commit_hooks.forbid_new_submodules:main',
|
||||||
'name-tests-test = pre_commit_hooks.tests_should_end_in_test:validate_files',
|
'name-tests-test = pre_commit_hooks.tests_should_end_in_test:validate_files',
|
||||||
'pretty-format-json = pre_commit_hooks.pretty_format_json:pretty_format_json',
|
'pretty-format-json = pre_commit_hooks.pretty_format_json:pretty_format_json',
|
||||||
'requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:fix_requirements_txt',
|
'requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:fix_requirements_txt',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue