mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Merge pull request #50 from pre-commit/manifest_to_hooks
Manifest to hooks
This commit is contained in:
commit
45e6a0b1eb
10 changed files with 27 additions and 29 deletions
|
|
@ -1,5 +1,5 @@
|
|||
- repo: git@github.com:pre-commit/pre-commit-hooks
|
||||
sha: 8aa14d218d0fe5a2c486498269b3e37d3ba5aad2
|
||||
sha: bec87f6c87284ea15dbcf7801810404c8036bab4
|
||||
hooks:
|
||||
- id: pyflakes
|
||||
files: \.py$
|
||||
|
|
@ -12,9 +12,9 @@
|
|||
- id: end-of-file-fixer
|
||||
files: \.(py|sh|yaml)$
|
||||
- repo: git@github.com:pre-commit/pre-commit
|
||||
sha: c695ee9a9a78ac73439c52e0085bafec8037bc2d
|
||||
sha: c62c1a3b513ab9e057e85a5e950bd7c438371076
|
||||
hooks:
|
||||
- id: validate_manifest
|
||||
files: ^manifest.yaml$
|
||||
files: ^hooks.yaml$
|
||||
- id: validate_config
|
||||
files: ^\.pre-commit-config.yaml$
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ CONFIG_FILE = '.pre-commit-config.yaml'
|
|||
|
||||
HOOKS_WORKSPACE = '.pre-commit-files'
|
||||
|
||||
MANIFEST_FILE = 'manifest.yaml'
|
||||
MANIFEST_FILE = 'hooks.yaml'
|
||||
|
||||
SUPPORTED_LANGUAGES = set([
|
||||
'python',
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
- repo: git@github.com:pre-commit/pre-commit-hooks
|
||||
sha: 76739902911688e8d7b13241409f9facc0e534e4
|
||||
sha: bec87f6c87284ea15dbcf7801810404c8036bab4
|
||||
hooks:
|
||||
- id: pyflakes
|
||||
files: '\.py$'
|
||||
files: \.py$
|
||||
- id: debug-statements
|
||||
files: '\.py$'
|
||||
files: \.py$
|
||||
- id: trailing-whitespace
|
||||
files: '\.(py|sh|yaml)$'
|
||||
files: \.(py|sh|yaml)$
|
||||
- id: name-tests-test
|
||||
files: 'tests/.+\.py$'
|
||||
files: tests/.+\.py$
|
||||
- id: end-of-file-fixer
|
||||
files: '\.(py|sh|yaml)$'
|
||||
|
||||
files: \.(py|sh|yaml)$
|
||||
- repo: git@github.com:pre-commit/pre-commit
|
||||
sha: 47b7ca44ed1fcaa83464ed00cef72049ae22c33d
|
||||
sha: c62c1a3b513ab9e057e85a5e950bd7c438371076
|
||||
hooks:
|
||||
- id: validate_manifest
|
||||
files: '^manifest.yaml$'
|
||||
files: ^hooks.yaml$
|
||||
- id: validate_config
|
||||
files: \.pre-commit-config.yaml
|
||||
files: ^\.pre-commit-config.yaml$
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class AdditionalValidatorError(ValueError): pass
|
|||
|
||||
@pytest.fixture
|
||||
def noop_validator():
|
||||
return get_validator('example_manifest.yaml', {}, ValueError)
|
||||
return get_validator('example_hooks.yaml', {}, ValueError)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -31,7 +31,7 @@ def additional_validator():
|
|||
raise AdditionalValidatorError
|
||||
|
||||
return get_validator(
|
||||
'example_manifest.yaml',
|
||||
'example_hooks.yaml',
|
||||
{},
|
||||
ValueError,
|
||||
additional_validation_strategy=raises_always,
|
||||
|
|
@ -52,7 +52,7 @@ def test_defaults_to_backup_filename(noop_validator):
|
|||
with mock.patch.object(__builtin__, 'open', side_effect=open) as mock_open:
|
||||
noop_validator()
|
||||
mock_open.assert_called_once_with(
|
||||
os.path.join(git.get_root(), 'example_manifest.yaml'), 'r',
|
||||
os.path.join(git.get_root(), 'example_hooks.yaml'), 'r',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from pre_commit.clientlib.validate_manifest import run
|
|||
|
||||
|
||||
def test_returns_0_for_valid_manifest():
|
||||
assert run(['example_manifest.yaml']) == 0
|
||||
assert run(['example_hooks.yaml']) == 0
|
||||
|
||||
|
||||
def test_returns_0_for_our_manifest():
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ def get_files_matching_func():
|
|||
'pre_commit/run.py',
|
||||
'pre_commit/git.py',
|
||||
'im_a_file_that_doesnt_exist.py',
|
||||
'manifest.yaml',
|
||||
'hooks.yaml',
|
||||
)
|
||||
|
||||
return git.get_files_matching(get_filenames)
|
||||
|
|
@ -33,7 +33,7 @@ def test_get_files_matching_base(get_files_matching_func):
|
|||
assert ret == set([
|
||||
'pre_commit/run.py',
|
||||
'pre_commit/git.py',
|
||||
'manifest.yaml',
|
||||
'hooks.yaml',
|
||||
])
|
||||
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ def test_get_files_matching_total_match(get_files_matching_func):
|
|||
|
||||
def test_does_search_instead_of_match(get_files_matching_func):
|
||||
ret = get_files_matching_func('\.yaml$')
|
||||
assert ret == set(['manifest.yaml'])
|
||||
assert ret == set(['hooks.yaml'])
|
||||
|
||||
|
||||
def test_does_not_include_deleted_fileS(get_files_matching_func):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue