Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: Enable most F rules for Ruff #574

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion codecov/settings_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from urllib.parse import urlparse

import django_prometheus
import sentry_sdk
from corsheaders.defaults import default_headers
from sentry_sdk.integrations.celery import CeleryIntegration
Expand Down Expand Up @@ -252,7 +253,7 @@
}

# See https://django-postgres-extra.readthedocs.io/en/master/settings.html
POSTGRES_EXTRA_DB_BACKEND_BASE: "django_prometheus.db.backends.postgresql"
POSTGRES_EXTRA_DB_BACKEND_BASE: "django_prometheus.db.backends.postgresql" # type: ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even post import it didn't resolve this correctly; but docs here: https://django-dbbackup.readthedocs.io/en/stable/databases.html


# Allows to use the pgpartition command
PSQLEXTRA_PARTITIONING_MANAGER = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.contrib.auth.models import AnonymousUser
from django.test import TransactionTestCase

from api.internal import pull
from core.models import PullStates
from core.tests.factories import OwnerFactory, PullFactory, RepositoryFactory
from reports.tests.factories import UploadFactory
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/tests/test_owner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
OwnerFactory,
UserFactory,
)
from core.tests.factories import CommitFactory, OwnerFactory, RepositoryFactory
from core.tests.factories import CommitFactory, RepositoryFactory
from plan.constants import PlanName, TrialStatus
from reports.tests.factories import CommitReportFactory, UploadFactory

Expand Down
1 change: 0 additions & 1 deletion graphql_api/tests/test_owner_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

from django.test import TransactionTestCase, override_settings
from django.utils import timezone

from codecov_auth.tests.factories import OwnerFactory
from core.tests.factories import RepositoryFactory
Expand Down
1 change: 0 additions & 1 deletion graphql_api/tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from freezegun import freeze_time

from codecov_auth.tests.factories import OwnerFactory
from core.tests.factories import OwnerFactory
from plan.constants import PlanName, TrialStatus

from .helper import GraphQLTestHelper
Expand Down
1 change: 0 additions & 1 deletion graphql_api/tests/test_plan_representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from freezegun import freeze_time

from codecov_auth.tests.factories import OwnerFactory
from core.tests.factories import OwnerFactory
from plan.constants import PlanName, TrialStatus

from .helper import GraphQLTestHelper
Expand Down
1 change: 0 additions & 1 deletion graphql_api/tests/test_repository_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from unittest.mock import patch

from django.test import TransactionTestCase, override_settings
from django.utils import timezone

from codecov_auth.tests.factories import OwnerFactory
from core.tests.factories import RepositoryFactory
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .component_comparison import component_comparison, component_comparison_bindable
from .config import config, config_bindable
from .coverage_totals import coverage_totals, coverage_totals_bindable
from .enums import enum_types, enums
from .enums import enum_types
from .file import commit_file, file_bindable
from .flag import flag, flag_bindable
from .flag_comparison import flag_comparison, flag_comparison_bindable
Expand Down
2 changes: 1 addition & 1 deletion graphql_api/types/commit/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
MissingHeadReport,
)
from graphql_api.types.enums import OrderingDirection, PathContentDisplayType
from graphql_api.types.errors import MissingCoverage, MissingHeadReport, UnknownPath
from graphql_api.types.errors import MissingCoverage, UnknownPath
from graphql_api.types.errors.errors import UnknownFlags
from services.bundle_analysis import BundleAnalysisComparison, BundleAnalysisReport
from services.comparison import Comparison, ComparisonReport
Expand Down
2 changes: 0 additions & 2 deletions graphql_api/types/mutation/mutation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from ariadne import MutationType

from graphql_api.types.mutation.start_trial.start_trial import resolve_start_trial

from .activate_measurements import (
error_activate_measurements,
resolve_activate_measurements,
Expand Down
4 changes: 2 additions & 2 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ target-version = "py312"

[lint]
# Currently only enabled for F541 and I: https://docs.astral.sh/ruff/rules/
select = ["F541", "I"]
ignore = []
select = ["F", "I"]
ignore = ["F841", "F401", "F405", "F403"]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preferred way of tackling this initiative; then we can have separate tickets for F841, etc. or multiple PR's

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 4 doesn't have autofixes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They have some autofixes, but theres like 2k errors I'd have to fix across all of them. So I figured would probably be better to tackle them separately


# Allow fix for all enabled rules (when `--fix`) is provided.
# The preferred method (for now) w.r.t. fixable rules is to manually update the makefile
Expand Down
1 change: 0 additions & 1 deletion services/yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from asgiref.sync import async_to_sync
from shared.yaml import UserYaml, fetch_current_yaml_from_provider_via_reference
from shared.yaml.user_yaml import UserYaml
from shared.yaml.validation import validate_yaml
from yaml import safe_load

Expand Down
1 change: 0 additions & 1 deletion timeseries/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pytest
from django.conf import settings
from django.test import TransactionTestCase
from django.utils import timezone
from freezegun import freeze_time
from freezegun.api import FakeDatetime
from shared.reports.resources import Report, ReportFile, ReportLine
Expand Down
2 changes: 0 additions & 2 deletions upload/tests/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,6 @@ async def get_commit(self, commit, token):
"reportid": "dec1f00b-1883-40d0-afd6-6dcb876510be",
"redis_key": "upload/b521e55/dec1f00b-1883-40d0-afd6-6dcb876510be/plain",
"url": None,
"branch": None,
"job": None,
}

Expand Down Expand Up @@ -1143,7 +1142,6 @@ async def get_commit(self, commit, token):
"reportid": "dec1f00b-1883-40d0-afd6-6dcb876510be",
"redis_key": "upload/b521e55/dec1f00b-1883-40d0-afd6-6dcb876510be/plain",
"url": None,
"branch": None,
"job": None,
}

Expand Down
Loading