From 25bb741fe7ead7c16a0739c05e14bc8f6c789d52 Mon Sep 17 00:00:00 2001 From: Yoann Schneider Date: Thu, 25 Jan 2024 11:33:57 +0100 Subject: [PATCH] Minimal changes introduced by Ruff formatter after double quotes enforcement --- .pre-commit-config.yaml | 6 +----- pyproject.toml | 10 ++++------ .../test_report_backfill_outcome.py | 2 +- .../perf/management/commands/reassign_perf_data.py | 4 +--- treeherder/perf/models.py | 6 ++---- treeherder/webapp/api/performance_data.py | 4 +--- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f45e6642c..1f5317503 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,9 +17,5 @@ repos: hooks: - id: ruff args: [--fix] - - repo: https://github.com/psf/black - rev: 23.3.0 - hooks: - - id: black - language_version: python3.9 + - id: ruff-format exclude: ^treeherder/.*/migrations diff --git a/pyproject.toml b/pyproject.toml index cfc336d88..8efc50912 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,11 +21,6 @@ mkdocs = { version = "==1.4.2", optional = true } mkdocs-material = { version = "==8.5.11", optional = true } mdx_truly_sane_lists = { version = "1.3", optional = true } -[tool.black] -line-length = 100 -target-version = ['py39'] -include = '\.pyi?$' - [tool.ruff] # Same as Black. line-length = 100 @@ -46,9 +41,12 @@ select = [ ignore = [ # E501: line too long - "E501" + "E501", ] +# Also lint/format pyi files +extend-include = ["*.pyi"] + [tool.ruff.per-file-ignores] # Ignore `module-import-not-at-top-of-file` rule of `pycodestyle` "treeherder/model/models.py" = ["E402"] diff --git a/tests/perf/auto_perf_sheriffing/test_report_backfill_outcome.py b/tests/perf/auto_perf_sheriffing/test_report_backfill_outcome.py index 7416e1f7a..b8eeec568 100644 --- a/tests/perf/auto_perf_sheriffing/test_report_backfill_outcome.py +++ b/tests/perf/auto_perf_sheriffing/test_report_backfill_outcome.py @@ -43,7 +43,7 @@ def test_email_is_still_sent_if_context_is_too_corrupt_to_be_actionable( record_ready_for_processing, sherlock_settings, broken_context_str, - tc_notify_mock + tc_notify_mock, # Note: parametrizes the test ): record_ready_for_processing.context = broken_context_str diff --git a/treeherder/perf/management/commands/reassign_perf_data.py b/treeherder/perf/management/commands/reassign_perf_data.py index 8b824fb31..f6056b015 100644 --- a/treeherder/perf/management/commands/reassign_perf_data.py +++ b/treeherder/perf/management/commands/reassign_perf_data.py @@ -41,9 +41,7 @@ class Command(BaseCommand): metavar="USE CASE", help="""Rename "old" Raptor tp6 subtests, by pointing perf alerts & datum to new signatures. Cannot be used in conjunction with --from/--to arguments. - Available use cases: {}""".format( - ",".join(USE_CASES) - ), + Available use cases: {}""".format(",".join(USE_CASES)), ) parser.add_argument( "--keep-leftovers", diff --git a/treeherder/perf/models.py b/treeherder/perf/models.py index 2751cfabc..16a2176ce 100644 --- a/treeherder/perf/models.py +++ b/treeherder/perf/models.py @@ -535,8 +535,7 @@ class PerformanceAlert(models.Model): # or absence of a related summary if self.related_summary and self.status not in self.RELATIONAL_STATUS_IDS: raise ValidationError( - "Related summary set but status not in " - "'{}'!".format( + "Related summary set but status not in " "'{}'!".format( ", ".join( [ STATUS[1] @@ -548,8 +547,7 @@ class PerformanceAlert(models.Model): ) if not self.related_summary and self.status not in self.UNRELATIONAL_STATUS_IDS: raise ValidationError( - "Related summary not set but status not in " - "'{}'!".format( + "Related summary not set but status not in " "'{}'!".format( ", ".join( [ STATUS[1] diff --git a/treeherder/webapp/api/performance_data.py b/treeherder/webapp/api/performance_data.py index e26d72791..58a646bd2 100644 --- a/treeherder/webapp/api/performance_data.py +++ b/treeherder/webapp/api/performance_data.py @@ -751,9 +751,7 @@ class PerformanceSummary(generics.ListAPIView): "push_timestamp", "push__revision", "performancedatumreplicate__value", - ).order_by( - "push_timestamp", "push_id", "job_id" - ): + ).order_by("push_timestamp", "push_id", "job_id"): if replicate_value is not None: item["data"].append( {