Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 75e8582

Browse files
committed
add ruff rules for prints and fix
1 parent 914b22c commit 75e8582

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

codecov_auth/commands/owner/interactors/get_is_current_user_an_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ def execute(self, owner, current_owner):
5050
owner.add_admin(current_owner)
5151
return isAdmin or (current_owner.ownerid in admins)
5252
except Exception as error:
53-
print("Error Calling Admin Provider " + repr(error))
53+
print("Error Calling Admin Provider " + repr(error)) # noqa: T201
5454
return False

core/management/commands/check_for_migration_conflicts.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,16 @@ def handle(self, *args, **options):
2222
for prefix, grouped_migrations in migrations_by_prefix.items():
2323
if len(grouped_migrations) > 1:
2424
conflicts_found = True
25-
print(
25+
print( # noqa: T201
2626
f"Conflict found in migrations for {app.name} with prefix {prefix}:"
2727
)
2828
for grouped_migration in grouped_migrations:
29-
print(grouped_migration)
30-
print()
29+
print(grouped_migration) # noqa: T201
3130
# It's expected to not find migration folders for Django/3rd party apps
3231
except FileNotFoundError:
3332
pass
3433

3534
if conflicts_found:
3635
raise Exception("Found conflicts in migrations.")
3736
else:
38-
print("No conflicts found!")
37+
print("No conflicts found!") # noqa: T201

core/management/commands/delete_rate_limit_keys.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def handle(self, *args, **options):
2121
for key in redis.scan_iter(path):
2222
# -1 means the key has no expiry
2323
if redis.ttl(key) == -1:
24-
print(f"Deleting key: {key.decode('utf-8')}")
24+
print(f"Deleting key: {key.decode('utf-8')}") # noqa: T201
2525
redis.delete(key)
2626
except Exception as e:
27-
print("Error occurred when deleting redis keys")
28-
print(e)
27+
print("Error occurred when deleting redis keys") # noqa: T201
28+
print(e) # noqa: T201

core/management/commands/update_gitlab_webhooks.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ def handle(self, *args, **options):
3131
)
3232

3333
for repo in repos:
34-
print("repoid:", repo.pk)
35-
3634
user = get_bot_user(repo)
3735
if user is None:
38-
print("no bot user")
3936
continue
4037

4138
webhook_secret = str(uuid.uuid4())
@@ -63,7 +60,7 @@ def handle(self, *args, **options):
6360
repo.webhook_secret = webhook_secret
6461
repo.save()
6562
except TorngitClientError as e:
66-
print("error making GitLab API call")
67-
print(e)
63+
print("error making GitLab API call") # noqa: T201
64+
print(e) # noqa: T201
6865
except TorngitRefreshTokenFailedError:
69-
print("refresh token failed")
66+
print("refresh token failed") # noqa: T201

graphql_api/tests/test_plan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,6 @@ def test_plan_user_count_for_enterprise_org(self, mocked_license):
210210
}
211211
""" % (enterprise_org.username)
212212
data = self.gql_request(query, owner=enterprise_org)
213-
print(data, "look here 1")
214213
assert data["owner"]["plan"]["planUserCount"] == 5
215214
assert data["owner"]["plan"]["hasSeatsLeft"] == False
216215

open_telemetry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ def export(self, spans):
141141
logging.exception("failed to export all spans")
142142
return SpanExportResult.FAILURE
143143
except requests.HTTPError as e:
144-
print(e)
145-
logging.exception("HTTP server returned erroneous response")
144+
logging.exception(
145+
"HTTP server returned erroneous response", extra=dict(error=e)
146+
)
146147
return SpanExportResult.FAILURE
147148
except requests.Timeout:
148149
logging.exception("request timed out")
149150
return SpanExportResult.FAILURE
150151
except Exception as e:
151-
print(e)
152-
logging.exception("request failed")
152+
logging.exception("request failed", extra=dict(error=e))
153153
return SpanExportResult.FAILURE
154154

155155
return SpanExportResult.SUCCESS

ruff.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ select = [
4646
"PERF", # perflint - performance anti-pattern rules
4747
"PLC", # pylint - convention rules
4848
"PLE", # pylint - error rules
49+
"T20", # flake8-print - print statements
4950
"W", # pycodestyle - warning rules
5051
]
5152
ignore = ["F405", "F403", "E501", "E712", "C408"]

0 commit comments

Comments
 (0)