mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-08 20:44:18 +00:00
display line content in non-compliant files in pre-commit messages
This commit is contained in:
parent
395564510b
commit
35b90438b9
2 changed files with 17 additions and 16 deletions
|
|
@ -14,8 +14,9 @@ def _get_file_verbose_occurrences(filename: str) -> int:
|
||||||
for i, line in enumerate(f, 1):
|
for i, line in enumerate(f, 1):
|
||||||
if CURL_VERBOSE_PATTERN.search(line):
|
if CURL_VERBOSE_PATTERN.search(line):
|
||||||
print(
|
print(
|
||||||
'Talkative/Verbose cURL command found: '
|
f'Talkative/Verbose cURL command found:'
|
||||||
'{filename}:{i}:{line}',
|
f'{repr(filename)}:{repr(i)}:{line.decode("utf-8")}',
|
||||||
|
end='',
|
||||||
)
|
)
|
||||||
file_verbose_occurrences += 1
|
file_verbose_occurrences += 1
|
||||||
return file_verbose_occurrences
|
return file_verbose_occurrences
|
||||||
|
|
|
||||||
|
|
@ -58,28 +58,28 @@ def test_failing(tmpdir, capsys):
|
||||||
|
|
||||||
out, _ = capsys.readouterr()
|
out, _ = capsys.readouterr()
|
||||||
assert out == (
|
assert out == (
|
||||||
"Talkative/Verbose cURL command found: f.sh:3:b\'curl -v -X GET"
|
"Talkative/Verbose cURL command found:'f.sh':3:curl -v -X GET"
|
||||||
" ${url} -H \"X-Custom-Header: pytest-test\"\\n\'\n"
|
" ${url} -H \"X-Custom-Header: pytest-test\"\n"
|
||||||
"Talkative/Verbose cURL command found: f.sh:4:b\'curl -X GET "
|
"Talkative/Verbose cURL command found:'f.sh':4:curl -X GET "
|
||||||
"${url} -H \"X-Custom-Header: pytest-test\" --verbose\\n\'\n"
|
"${url} -H \"X-Custom-Header: pytest-test\" --verbose\n"
|
||||||
'Talkative/Verbose cURL command found: '
|
'Talkative/Verbose cURL command found:'
|
||||||
"f.sh:5:b\'curl --write-out output.txt"
|
"'f.sh':5:curl --write-out output.txt"
|
||||||
" -X GET ${url} -H \"X-Custom-Header: pytest-test\"\\n\'\n"
|
" -X GET ${url} -H \"X-Custom-Header: pytest-test\"\n"
|
||||||
|
|
||||||
"Talkative/Verbose cURL command found: f.groovy:3:b\'curl "
|
"Talkative/Verbose cURL command found:'f.groovy':3:curl "
|
||||||
"-d \"{key1:value1, key2:value2}\""
|
"-d \"{key1:value1, key2:value2}\""
|
||||||
" -w output.txt -H \"Content-Type: application/json\""
|
" -w output.txt -H \"Content-Type: application/json\""
|
||||||
" -X POST ${url}\\n\'\n"
|
' -X POST ${url}\n'
|
||||||
'Talkative/Verbose cURL command found:'
|
'Talkative/Verbose cURL command found:'
|
||||||
" f.groovy:4:b\'curl "
|
"'f.groovy':4:curl "
|
||||||
'--trace-ascii ascii.txt '
|
'--trace-ascii ascii.txt '
|
||||||
"-d \"{key1:value1, key2:value2}\""
|
"-d \"{key1:value1, key2:value2}\""
|
||||||
" -H \"Content-Type: application/json\" "
|
" -H \"Content-Type: application/json\" "
|
||||||
"-X POST ${url}\\n\'\n"
|
'-X POST ${url}\n'
|
||||||
"Talkative/Verbose cURL command found: f.groovy:5:b\'curl "
|
"Talkative/Verbose cURL command found:'f.groovy':5:curl "
|
||||||
"-d \"{key1:value1, key2:value2}\""
|
"-d \"{key1:value1, key2:value2}\""
|
||||||
'-X POST ${url} --trace trace.txt '
|
' -X POST ${url} --trace trace.txt '
|
||||||
" -H \"Content-Type: application/json\"\\n\'\n"
|
" -H \"Content-Type: application/json\"\n"
|
||||||
|
|
||||||
'Number of talkative/verbose cURL commands: 6\n'
|
'Number of talkative/verbose cURL commands: 6\n'
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue