Browse Source

fix(hybridcloud) Ignore fixtures/ from production code linting. (#54416)

Add an ignore to metrics code as well. Unwinding this testutils import
doesn't seem straightforward and it would be better if the original team
took on this work.
Mark Story 1 year ago
parent
commit
9935a868ee
2 changed files with 3 additions and 1 deletions
  1. 1 1
      src/sentry/sentry_metrics/client/snuba.py
  2. 2 0
      tools/flake8_plugin.py

+ 1 - 1
src/sentry/sentry_metrics/client/snuba.py

@@ -8,7 +8,7 @@ from django.core.cache import cache
 from sentry import quotas
 from sentry.sentry_metrics.client.base import GenericMetricsBackend
 from sentry.sentry_metrics.use_case_id_registry import UseCaseID
-from sentry.testutils.cases import BaseMetricsTestCase
+from sentry.testutils.cases import BaseMetricsTestCase  # NOQA:S007
 
 
 def build_mri(metric_name: str, type: str, use_case_id: UseCaseID, unit: Optional[str]) -> str:

+ 2 - 0
tools/flake8_plugin.py

@@ -49,6 +49,7 @@ class SentryVisitor(ast.NodeVisitor):
                 self.errors.append((node.lineno, node.col_offset, S006_msg))
             elif (
                 "tests/" not in self.filename
+                and "fixtures/" not in self.filename
                 and "sentry/testutils/" not in self.filename
                 and "sentry.testutils" in node.module
             ):
@@ -62,6 +63,7 @@ class SentryVisitor(ast.NodeVisitor):
                 self.errors.append((node.lineno, node.col_offset, S003_msg))
             elif (
                 "tests/" not in self.filename
+                and "fixtures/" not in self.filename
                 and "sentry/testutils/" not in self.filename
                 and "sentry.testutils" in alias.name
             ):