Add forbid-new-submodules to hooks.yaml

This commit is contained in:
Chris Kuehl 2016-11-30 10:10:29 -08:00
parent 7bcb6a92bf
commit 4b928ab06b
4 changed files with 10 additions and 0 deletions

View file

@ -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.
- To remove the coding pragma pass `--remove` (useful in a python3-only codebase)
- `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`.
- Use `args: ['--django']` to match `test*.py` instead.
- `pyflakes` - Run pyflakes on your python files.

View file

@ -117,6 +117,12 @@
entry: flake8
language: python
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
name: Tests should end in _test.py
description: This verifies that test files are named correctly

View file

@ -1,4 +1,5 @@
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from pre_commit_hooks.util import cmd_output
@ -19,6 +20,7 @@ def main(argv=None):
retv = 1
if retv:
print()
print('This commit introduces new submodules.')
print('Did you unintentionally `git add .`?')
print('To fix: git rm {thesubmodule} # no trailing slash')

View file

@ -52,6 +52,7 @@ setup(
'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',
'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',
'pretty-format-json = pre_commit_hooks.pretty_format_json:pretty_format_json',
'requirements-txt-fixer = pre_commit_hooks.requirements_txt_fixer:fix_requirements_txt',