mirror of
https://github.com/enzet/map-machine.git
synced 2025-07-19 17:37:58 +02:00
Fix warnings.
This commit is contained in:
parent
84f7e1cef5
commit
9f770a35cc
11 changed files with 47 additions and 36 deletions
|
@ -1,28 +1,36 @@
|
|||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="%USERNAME%">
|
||||
<words>
|
||||
<w>addr</w>
|
||||
<w>arecaceae</w>
|
||||
<w>betula</w>
|
||||
<w>carto</w>
|
||||
<w>changeset</w>
|
||||
<w>dasharray</w>
|
||||
<w>defs</w>
|
||||
<w>dharmachakra</w>
|
||||
<w>flinger</w>
|
||||
<w>githooks</w>
|
||||
<w>housenumber</w>
|
||||
<w>josm</w>
|
||||
<w>landuse</w>
|
||||
<w>levelname</w>
|
||||
<w>linalg</w>
|
||||
<w>linecap</w>
|
||||
<w>linejoin</w>
|
||||
<w>lunokhod</w>
|
||||
<w>mapcss</w>
|
||||
<w>maxlat</w>
|
||||
<w>maxlon</w>
|
||||
<w>maxspeed</w>
|
||||
<w>minlat</w>
|
||||
<w>minlon</w>
|
||||
<w>needleleaved</w>
|
||||
<w>noninfringement</w>
|
||||
<w>osmic</w>
|
||||
<w>portolan</w>
|
||||
<w>rasterize</w>
|
||||
<w>rasterized</w>
|
||||
<w>röntgen</w>
|
||||
<w>subparser</w>
|
||||
<w>svgwrite</w>
|
||||
|
|
|
@ -30,7 +30,7 @@ def check_file(file_name: str) -> Optional[str]:
|
|||
|
||||
|
||||
def check_commit_message(parts: List[str]) -> Optional[str]:
|
||||
|
||||
"""Check whether the commit message is well-formed."""
|
||||
short_message: str = parts[0]
|
||||
|
||||
if short_message[0] != short_message[0].upper():
|
||||
|
@ -77,7 +77,8 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
|
|||
+ '\nCommit message should end with ".".'
|
||||
)
|
||||
|
||||
def up(text: str):
|
||||
def first_letter_uppercase(text: str):
|
||||
"""Change first letter to upper case."""
|
||||
return text[0].upper() + text[1:]
|
||||
|
||||
verbs_1 = ["add", "fix", "check", "refactor"]
|
||||
|
@ -101,16 +102,18 @@ def check_commit_message(parts: List[str]) -> Optional[str]:
|
|||
|
||||
for verb in verbs:
|
||||
if short_message.startswith(f"{verb} ") or short_message.startswith(
|
||||
f"{up(verb)} "
|
||||
f"{first_letter_uppercase(verb)} "
|
||||
):
|
||||
return (
|
||||
f'Commit message should start with the verb in infinitive '
|
||||
f'form. Please, use "{up(verbs[verb])} ..." instead of '
|
||||
f'"{up(verb)} ...".'
|
||||
f'form. Please, use '
|
||||
f'"{first_letter_uppercase(verbs[verb])} ..." instead of '
|
||||
f'"{first_letter_uppercase(verb)} ...".'
|
||||
)
|
||||
|
||||
|
||||
def check(commit_message):
|
||||
def check(commit_message: str) -> None:
|
||||
"""Print commit_message and checking result."""
|
||||
print("\033[33m" + commit_message + "\033[0m")
|
||||
print(check_commit_message(commit_message.split("\n")))
|
||||
|
||||
|
@ -120,7 +123,7 @@ def test():
|
|||
check("Added foo.")
|
||||
check("Created foo.")
|
||||
check("Doesn't end with dot")
|
||||
check("Tooooooooooooooooooooooooooooooooooooooooooooo long")
|
||||
check("To-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o-o long")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue