Clean Code: Apply flake8-simplify to Python

Also flake8-comprehensions which was added to the CI

For flake8-simplify, there are a few false-positives,
e.g. https://github.com/MartinThoma/flake8-simplify/issues/115
This commit is contained in:
Martin Thoma
2022-03-18 22:27:31 +01:00
parent d43ec589c8
commit 3b2739b8a2
28 changed files with 168 additions and 214 deletions

View File

@@ -34,7 +34,7 @@ prev_game = ""
for dirName, subdirList, fileList in os.walk(rootDir):
split_dir = dirName.split(os.path.sep)
if len(split_dir) == 2 and not split_dir[1] in [".git", "00_Utilities"]:
if len(split_dir) == 2 and split_dir[1] not in [".git", "00_Utilities"]:
if prev_game == "":
prev_game = split_dir[1]
checklist[0] = split_dir[1]
@@ -55,13 +55,12 @@ for dirName, subdirList, fileList in os.walk(rootDir):
]
prev_game = split_dir[1]
elif len(split_dir) == 3 and split_dir[1] != ".git":
if split_dir[2] in lang_pos.keys():
if len(fileList) > 1 or len(subdirList) > 0:
# there is more files than the readme
checklist[lang_pos[split_dir[2]]] = ""
else:
checklist[lang_pos[split_dir[2]]] = "⬜️"
elif len(split_dir) == 3 and split_dir[1] != ".git" and split_dir[2] in lang_pos:
if len(fileList) > 1 or len(subdirList) > 0:
# there is more files than the readme
checklist[lang_pos[split_dir[2]]] = ""
else:
checklist[lang_pos[split_dir[2]]] = "⬜️"
sorted_strings = list(