Skip to content

Commit 5842d8b

Browse files
authored
Add flake8 test to detect usage of fstrings. (#832)
* Add flake8-no-fstring to detect usage of fstrings. * Remove fstrings from code.
1 parent e80d5fc commit 5842d8b

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

examples/bitbucket/stash_user_auth_report.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def report(limit=200, include_in_active=False):
2929
else:
3030
full_date = None
3131
if include_in_active or user.get("active"):
32-
output = f"|{user.get('active')}|{user.get('displayName')}|{user.get('emailAddress')}|{full_date}|"
32+
output = "|{}|{}|{}|{}|".format(
33+
user.get("active"), user.get("displayName"), user.get("emailAddress"), full_date
34+
)
3335
print(output)
3436

3537

examples/jira/jira_dc_create_support_zips.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
for task in jira.check_support_zip_status(zips_creation_task_id)["tasks"]:
1515

1616
if task["status"] == "IN_PROGRESS":
17-
print(f"file {task['fileName']} {task['progressMessage']}")
17+
print("file {} {}".format(task["fileName"], task["progressMessage"]))
1818

1919
if task["fileName"] not in in_progress_zips:
2020
in_progress_zips.append(task["fileName"])
@@ -25,7 +25,7 @@
2525
with open(task["fileName"], "wb") as fp:
2626
fp.write(support_zip)
2727

28-
print(f"{task['fileName']} written.")
28+
print("{} written.".format(task["fileName"]))
2929

3030
if task["fileName"] in in_progress_zips:
3131
in_progress_zips.remove(task["fileName"])

examples/jira/jira_jql_fetcher_as_weekly_report.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,17 @@ def __get_changes_of_cases(self, histories):
6363
continue
6464
output = [
6565
history.get("author").get("name"),
66-
f"{change_date:%Y-%m-%d}",
66+
change_date.format("%Y-%m-%d"),
6767
] # person who did the change
6868
changes = ["Listing all items that changed:"]
6969
for item in history.get("items"):
70-
changes.append(f"{item['field']} - {item['fromString']}- {item['toString']}")
70+
changes.append(
71+
"{} - {}- {}".format(
72+
item["field"],
73+
item["fromString"],
74+
item["toString"],
75+
)
76+
)
7177
output.append("\t".join(changes))
7278
return " - ".join(output)
7379

@@ -84,7 +90,7 @@ def console_output(self, delimiter="|", console=True):
8490
number = 1
8591
data = []
8692
for case in self.cases:
87-
print(f"Processing case #{number}")
93+
print("Processing case #{}".format(number))
8894
output = [
8995
case.get("actor"),
9096
case.get("key"),

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mock
33
pytest
44
pytest-cov
55
flake8
6+
flake8-no-fstring
67
black
78
tox
89
coverage

tox.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ parallel_show_output = true
2020
[testenv:flake8]
2121
basepython = python3
2222
skip_install = true
23-
deps = flake8
23+
deps =
24+
flake8
25+
flake8-no-fstring
2426
commands = flake8
2527

2628
[testenv:pylint]

0 commit comments

Comments
 (0)