Skip to content

Commit 7119acd

Browse files
committed
Merge pull request pre-commit#174 from bukzor/buck-172-error-clobbering
fix error clobbering
2 parents 7d546c1 + cdf0dae commit 7119acd

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

pre_commit/clientlib/validate_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def is_regex_valid(regex):
2121

2222

2323
def get_validator(
24-
json_schema,
25-
exception_type,
26-
additional_validation_strategy=lambda obj: None,
24+
json_schema,
25+
exception_type,
26+
additional_validation_strategy=lambda obj: None,
2727
):
2828
"""Returns a function which will validate a yaml file for correctness
2929
@@ -44,14 +44,14 @@ def validate(filename, load_strategy=yaml.load):
4444
obj = load_strategy(file_contents)
4545
except Exception as e:
4646
raise exception_type(
47-
'File {0} is not a valid yaml file'.format(filename), e,
47+
'Invalid yaml: {0}\n{1}'.format(os.path.relpath(filename), e),
4848
)
4949

5050
try:
5151
jsonschema.validate(obj, json_schema)
5252
except jsonschema.exceptions.ValidationError as e:
5353
raise exception_type(
54-
'File {0} is not a valid file'.format(filename), e,
54+
'Invalid content: {0}\n{1}'.format(os.path.relpath(filename), e),
5555
)
5656

5757
obj = apply_defaults(obj, json_schema)

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ deps =
2323
sphinx
2424
changedir = docs
2525
commands = sphinx-build -b html -d build/doctrees source build/html
26+
27+
[flake8]
28+
max-line-length=131

0 commit comments

Comments
 (0)