Added fix end of file hook.

This commit is contained in:
Anthony Sottile 2014-03-22 21:49:10 -07:00
parent 8c30419c13
commit dc1494d0e7
13 changed files with 15 additions and 16 deletions

View file

@ -1,15 +1,17 @@
- repo: git@github.com:pre-commit/pre-commit-hooks - repo: git@github.com:pre-commit/pre-commit-hooks
sha: 12794c1c19c001e3d05bcfe316b4f93b414035a7 sha: 76739902911688e8d7b13241409f9facc0e534e4
hooks: hooks:
- id: pyflakes - id: pyflakes
files: '\.py$' files: '\.py$'
- id: debug-statements - id: debug-statements
files: '\.py$' files: '\.py$'
- id: trailing-whitespace - id: trailing-whitespace
files: '\.(py|sh)$' files: '\.(py|sh|yaml)$'
- id: name-tests-test - id: name-tests-test
files: 'tests/.+\.py$' files: 'tests/.+\.py$'
- id: end-of-file-fixer
files: '\.(py|sh|yaml)$'
- repo: git@github.com:pre-commit/pre-commit - repo: git@github.com:pre-commit/pre-commit
sha: 47b7ca44ed1fcaa83464ed00cef72049ae22c33d sha: 47b7ca44ed1fcaa83464ed00cef72049ae22c33d

View file

@ -50,4 +50,4 @@ def get_validator(
return obj return obj
return validate return validate

View file

@ -9,4 +9,4 @@ SUPPORTED_LANGUAGES = set([
'python', 'python',
'ruby', 'ruby',
'node', 'node',
]) ])

View file

@ -18,4 +18,4 @@ def in_hooks_workspace():
local.path(get_pre_commit_dir_path()).mkdir() local.path(get_pre_commit_dir_path()).mkdir()
with local.cwd(get_pre_commit_dir_path()): with local.cwd(get_pre_commit_dir_path()):
yield yield

View file

@ -21,4 +21,4 @@ languages = {
'node': node, 'node': node,
'python': python, 'python': python,
'ruby': ruby, 'ruby': ruby,
} }

View file

@ -33,4 +33,4 @@ def install_environment():
def run_hook(hook, file_args): def run_hook(hook, file_args):
with in_env() as env: with in_env() as env:
return helpers.run_hook(env, hook, file_args) return helpers.run_hook(env, hook, file_args)

View file

@ -69,4 +69,4 @@ def test_raises_when_additional_validation_fails(additional_validator):
def test_returns_object_after_validating(noop_validator): def test_returns_object_after_validating(noop_validator):
ret = noop_validator('tests/data/array_yaml_file.yaml') ret = noop_validator('tests/data/array_yaml_file.yaml')
assert ret == ['foo', 'bar'] assert ret == ['foo', 'bar']

View file

@ -59,4 +59,4 @@ def is_valid_according_to_schema(obj, schema):
)) ))
def test_is_valid_according_to_schema(manifest_obj, expected): def test_is_valid_according_to_schema(manifest_obj, expected):
ret = is_valid_according_to_schema(manifest_obj, MANIFEST_JSON_SCHEMA) ret = is_valid_according_to_schema(manifest_obj, MANIFEST_JSON_SCHEMA)
assert ret is expected assert ret is expected

View file

@ -1,2 +1,2 @@
- foo - foo
- bar - bar

View file

@ -1 +1 @@
foo: " foo: "

View file

@ -1 +1 @@
foo: bar foo: bar

View file

@ -12,4 +12,4 @@ def test_all_languages_have_repo_setups():
@pytest.mark.parametrize('language', C.SUPPORTED_LANGUAGES) @pytest.mark.parametrize('language', C.SUPPORTED_LANGUAGES)
def test_all_languages_support_interface(language): def test_all_languages_support_interface(language):
assert hasattr(languages[language], 'install_environment') assert hasattr(languages[language], 'install_environment')
assert hasattr(languages[language], 'run_hook') assert hasattr(languages[language], 'run_hook')

View file

@ -104,6 +104,3 @@ def test_sha(mock_repo_config):
def test_languages(config_for_python_pre_commit_git_repo): def test_languages(config_for_python_pre_commit_git_repo):
repo = Repository(config_for_python_pre_commit_git_repo) repo = Repository(config_for_python_pre_commit_git_repo)
assert repo.languages == set(['python']) assert repo.languages == set(['python'])