Fix Pylint warnings.

This commit is contained in:
Sergey Vartanov 2021-11-10 02:20:48 +03:00
parent bd1efbfe2c
commit c3dfaf0604
18 changed files with 101 additions and 71 deletions

View file

@ -29,7 +29,8 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
if short_message[0] != short_message[0].upper():
return (
short_message + "\n^"
short_message
+ "\n^"
+ "\nCommit message short description should start with uppercase "
+ "letter."
)
@ -95,12 +96,12 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
verbs[verb + "d"] = verb
for wrong_verb, right_verb in verbs.items():
if short_message.startswith(f"{wrong_verb} ") or short_message.startswith(
f"{first_letter_uppercase(wrong_verb)} "
):
if short_message.startswith(
f"{wrong_verb} "
) or short_message.startswith(f"{first_letter_uppercase(wrong_verb)} "):
return (
f'Commit message should start with the verb in infinitive '
f'form. Please, use '
f"Commit message should start with the verb in infinitive "
f"form. Please, use "
f'"{first_letter_uppercase(right_verb)} ..." instead of '
f'"{first_letter_uppercase(wrong_verb)} ...".'
)

View file

@ -1,8 +1,10 @@
#!/bin/sh
python_files="map_machine setup.py tests data/githooks/commit-msg"
echo "Checking code format with Black..."
if ! black -l 80 --check tests map_machine; then
black -l 80 --diff --color tests map_machine
if ! black -l 80 --check ${python_files}; then
black -l 80 --diff --color ${python_files}
echo "FAIL"
exit 1
fi
@ -13,5 +15,5 @@ echo "Lint with Flake8..."
flake8 \
--max-line-length=80 \
--ignore=E203,W503,ANN002,ANN003,ANN101,ANN102 \
map_machine setup.py tests \
${python_files} \
|| { echo "FAIL"; exit 1; }