diff --git a/codecov_auth/commands/owner/interactors/get_is_current_user_an_admin.py b/codecov_auth/commands/owner/interactors/get_is_current_user_an_admin.py index 975e39041e..46906de909 100644 --- a/codecov_auth/commands/owner/interactors/get_is_current_user_an_admin.py +++ b/codecov_auth/commands/owner/interactors/get_is_current_user_an_admin.py @@ -50,5 +50,5 @@ def execute(self, owner, current_owner): owner.add_admin(current_owner) return isAdmin or (current_owner.ownerid in admins) except Exception as error: - print("Error Calling Admin Provider " + repr(error)) + print("Error Calling Admin Provider " + repr(error)) # noqa: T201 return False diff --git a/core/management/commands/check_for_migration_conflicts.py b/core/management/commands/check_for_migration_conflicts.py index 85b965c678..29e77ac14f 100644 --- a/core/management/commands/check_for_migration_conflicts.py +++ b/core/management/commands/check_for_migration_conflicts.py @@ -22,12 +22,11 @@ def handle(self, *args, **options): for prefix, grouped_migrations in migrations_by_prefix.items(): if len(grouped_migrations) > 1: conflicts_found = True - print( + print( # noqa: T201 f"Conflict found in migrations for {app.name} with prefix {prefix}:" ) for grouped_migration in grouped_migrations: - print(grouped_migration) - print() + print(grouped_migration) # noqa: T201 # It's expected to not find migration folders for Django/3rd party apps except FileNotFoundError: pass @@ -35,4 +34,4 @@ def handle(self, *args, **options): if conflicts_found: raise Exception("Found conflicts in migrations.") else: - print("No conflicts found!") + print("No conflicts found!") # noqa: T201 diff --git a/core/management/commands/delete_rate_limit_keys.py b/core/management/commands/delete_rate_limit_keys.py index 075a33862e..03389a0016 100644 --- a/core/management/commands/delete_rate_limit_keys.py +++ b/core/management/commands/delete_rate_limit_keys.py @@ -21,8 +21,8 @@ def handle(self, *args, **options): for key in redis.scan_iter(path): # -1 means the key has no expiry if redis.ttl(key) == -1: - print(f"Deleting key: {key.decode('utf-8')}") + print(f"Deleting key: {key.decode('utf-8')}") # noqa: T201 redis.delete(key) except Exception as e: - print("Error occurred when deleting redis keys") - print(e) + print("Error occurred when deleting redis keys") # noqa: T201 + print(e) # noqa: T201 diff --git a/core/management/commands/update_gitlab_webhooks.py b/core/management/commands/update_gitlab_webhooks.py index 74697aaf1b..c97a919546 100644 --- a/core/management/commands/update_gitlab_webhooks.py +++ b/core/management/commands/update_gitlab_webhooks.py @@ -31,11 +31,8 @@ def handle(self, *args, **options): ) for repo in repos: - print("repoid:", repo.pk) - user = get_bot_user(repo) if user is None: - print("no bot user") continue webhook_secret = str(uuid.uuid4()) @@ -63,7 +60,7 @@ def handle(self, *args, **options): repo.webhook_secret = webhook_secret repo.save() except TorngitClientError as e: - print("error making GitLab API call") - print(e) + print("error making GitLab API call") # noqa: T201 + print(e) # noqa: T201 except TorngitRefreshTokenFailedError: - print("refresh token failed") + print("refresh token failed") # noqa: T201 diff --git a/graphql_api/tests/test_plan.py b/graphql_api/tests/test_plan.py index ac136a521d..371b50ea65 100644 --- a/graphql_api/tests/test_plan.py +++ b/graphql_api/tests/test_plan.py @@ -210,7 +210,6 @@ def test_plan_user_count_for_enterprise_org(self, mocked_license): } """ % (enterprise_org.username) data = self.gql_request(query, owner=enterprise_org) - print(data, "look here 1") assert data["owner"]["plan"]["planUserCount"] == 5 assert data["owner"]["plan"]["hasSeatsLeft"] == False diff --git a/open_telemetry.py b/open_telemetry.py index 1e12ba4c46..14d674d562 100644 --- a/open_telemetry.py +++ b/open_telemetry.py @@ -141,15 +141,15 @@ def export(self, spans): logging.exception("failed to export all spans") return SpanExportResult.FAILURE except requests.HTTPError as e: - print(e) - logging.exception("HTTP server returned erroneous response") + logging.exception( + "HTTP server returned erroneous response", extra=dict(error=e) + ) return SpanExportResult.FAILURE except requests.Timeout: logging.exception("request timed out") return SpanExportResult.FAILURE except Exception as e: - print(e) - logging.exception("request failed") + logging.exception("request failed", extra=dict(error=e)) return SpanExportResult.FAILURE return SpanExportResult.SUCCESS diff --git a/ruff.toml b/ruff.toml index 00a1200de5..7bea1227e6 100644 --- a/ruff.toml +++ b/ruff.toml @@ -46,6 +46,7 @@ select = [ "PERF", # perflint - performance anti-pattern rules "PLC", # pylint - convention rules "PLE", # pylint - error rules + "T20", # flake8-print - print statements "W", # pycodestyle - warning rules ] ignore = ["F405", "F403", "E501", "E712", "C408"]