Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit de2ead1

Browse files
committed
Minor fixups
1 parent 7c8272d commit de2ead1

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

pre_commit/clientlib/validate_config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class InvalidConfigError(FatalError):
4141
},
4242
'additional_dependencies': {
4343
'type': 'array',
44-
'items': {'type': 'string'}
45-
}
44+
'items': {'type': 'string'},
45+
},
4646
},
4747
'required': ['id'],
4848
}

pre_commit/clientlib/validate_manifest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ class InvalidManifestError(ValueError):
3838
'type': 'string',
3939
},
4040
},
41+
'additional_dependencies': {
42+
'type': 'array',
43+
'items': {'type': 'string'},
44+
},
4145
},
4246
'required': ['id', 'name', 'entry', 'language', 'files'],
4347
},

pre_commit/repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ def additional_dependencies(self):
5555
dep_dict = defaultdict(lambda: defaultdict(set))
5656
for _, hook in self.hooks:
5757
dep_dict[hook['language']][hook['language_version']].update(
58-
hook.get('additional_dependencies', []))
58+
hook.get('additional_dependencies', []),
59+
)
5960
return dep_dict
6061

6162
@cached_property
@@ -118,7 +119,8 @@ def language_is_installed(language_name, language_version):
118119

119120
language.install_environment(
120121
self.cmd_runner, language_version,
121-
self.additional_dependencies[language_name][language_version])
122+
self.additional_dependencies[language_name][language_version],
123+
)
122124
# Touch the .installed file (atomic) to indicate we've installed
123125
open(self.cmd_runner.path(directory, '.installed'), 'w').close()
124126

tests/repository_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ def mock_repo_config():
294294
'hooks': [{
295295
'id': 'pyflakes',
296296
'files': '\\.py$',
297-
'additional_dependencies': ['pep8']
298297
}],
299298
}
300299
config_wrapped = apply_defaults([config], CONFIG_JSON_SCHEMA)
@@ -345,12 +344,12 @@ def test_additional_python_dependencies_installed(tempdir_factory, store):
345344
def test_additional_ruby_dependencies_installed(tempdir_factory, store):
346345
path = make_repo(tempdir_factory, 'ruby_hooks_repo')
347346
config = make_config_from_repo(path)
348-
config['hooks'][0]['additional_dependencies'] = ['mime-types']
347+
config['hooks'][0]['additional_dependencies'] = ['thread_safe']
349348
repo = Repository.create(config, store)
350349
repo.run_hook(repo.hooks[0][1], [])
351350
with ruby.in_env(repo.cmd_runner, 'default') as env:
352351
output = env.run('gem list --local')[1]
353-
assert 'mime-types' in output
352+
assert 'thread_safe' in output
354353

355354

356355
@pytest.mark.integration

0 commit comments

Comments
 (0)