Skip to content

Commit 3d62076

Browse files
committed
refactor: migrate from black+flake8+isort to ruff
Replace three separate linting/formatting tools with Ruff: - black -> ruff format (same Black-compatible style) - flake8 -> ruff check (E/F/W/C90 aligned with what CI historically enforced) - isort -> ruff lint isort (same known-first-party settings) Delete standalone .flake8 config (rules moved to pyproject.toml). Update .pre-commit-config.yaml: replace ambv/black, flake8, isort hooks with astral-sh/ruff-pre-commit v0.15.8. Bump pre-commit-hooks to v5.0.0. Merge chore/prettier-v3-reformatting so Prettier and Ruff agree on formatted files. Small lint-driven fixes: isinstance for GitHub client checks; remove redundant EnvironmentVarGuard assignments; import Salesforce from simple_salesforce.api.
1 parent 04c6afc commit 3d62076

144 files changed

Lines changed: 1015 additions & 1039 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.flake8

Lines changed: 0 additions & 8 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
default_language_version:
22
python: python3
33
repos:
4-
- repo: https://github.com/ambv/black
5-
rev: 22.3.0
4+
- repo: https://github.com/astral-sh/ruff-pre-commit
5+
rev: v0.15.8
66
hooks:
7-
- id: black
7+
- id: ruff
8+
args: [--fix]
9+
- id: ruff-format
810
- repo: https://github.com/pre-commit/pre-commit-hooks
9-
rev: v2.0.0
11+
rev: v5.0.0
1012
hooks:
1113
- id: check-merge-conflict
12-
- id: flake8
1314
- id: debug-statements
1415
exclude: "cumulusci/(utils/logging|cli/cci|tasks/robotframework/debugger/ui|cli/task|robotframework/utils).py"
1516
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
1617
rev: v1.0.1
1718
hooks:
1819
- id: rst-linter
1920
exclude: "docs"
20-
- repo: https://github.com/pycqa/isort
21-
rev: 5.12.0
22-
hooks:
23-
- id: isort
24-
args: ["--profile", "black", "--filter-files"]
2521
- repo: https://github.com/pre-commit/mirrors-prettier
2622
rev: v3.1.0
2723
hooks:

cumulusci/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
if sys.version_info < (3, 8): # pragma: no cover
1515
raise Exception("CumulusCI requires Python 3.8+.")
1616

17-
api.OrderedDict = dict
18-
bulk.OrderedDict = dict
17+
api.OrderedDict = dict # pyright: ignore[reportPrivateImportUsage]
18+
bulk.OrderedDict = dict # pyright: ignore[reportPrivateImportUsage]

cumulusci/cli/flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def flow_doc(runtime, project=False):
4444
flows_by_group = group_items(flows)
4545
flow_groups = sorted(
4646
flows_by_group.keys(),
47-
key=lambda group: flow_info_groups.index(group)
48-
if group in flow_info_groups
49-
else 100,
47+
key=lambda group: (
48+
flow_info_groups.index(group) if group in flow_info_groups else 100
49+
),
5050
)
5151

5252
for group in flow_groups:

cumulusci/cli/logger.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" CLI logger """
1+
"""CLI logger"""
2+
23
import logging
34
import os
45
import sys

cumulusci/cli/org.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def set_org_name(required):
3434
3535
`required` is a boolean for whether org_name is required
3636
"""
37+
3738
# could be generalized to work for any mutex pair (or list) but no obvious need
3839
def callback(ctx, param, value):
3940
"""Callback which enforces mutex and 'required' behaviour (if required)."""
@@ -474,7 +475,6 @@ def org_prune(runtime, include_active=False):
474475
org_shapes_skipped = []
475476
active_orgs_skipped = []
476477
for org_name in runtime.keychain.list_orgs():
477-
478478
org_config = runtime.keychain.get_org(org_name)
479479

480480
if org_name in predefined_scratch_configs:

cumulusci/cli/project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ def init_from_context(context: Dict[str, object], echo: bool = False):
246246

247247
# Create sfdx-project.json
248248
if not os.path.isfile("sfdx-project.json"):
249-
250249
sfdx_project = {
251250
"packageDirectories": [{"path": "force-app", "default": True}],
252251
"namespace": context["package_namespace"],

cumulusci/cli/runtime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, *args, **kwargs):
2323
super(CliRuntime, self).__init__(*args, **kwargs)
2424
except ConfigError as e:
2525
raise click.UsageError(f"Config Error: {str(e)}")
26-
except (KeychainKeyNotFound) as e:
26+
except KeychainKeyNotFound as e:
2727
raise click.UsageError(f"Keychain Error: {str(e)}")
2828

2929
def get_keychain_class(self):

cumulusci/cli/tests/test_error.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def test_error_gist(
9898
)
9999
webbrowser_open.assert_called_once_with(expected_gist_url)
100100

101-
@pytest.mark.skipif(sys.version_info > (3, 11), reason="requires python3.10 or higher")
101+
@pytest.mark.skipif(
102+
sys.version_info > (3, 11), reason="requires python3.10 or higher"
103+
)
102104
@mock.patch("cumulusci.cli.error.platform")
103105
@mock.patch("cumulusci.cli.error.sys")
104106
@mock.patch("cumulusci.cli.error.datetime")

cumulusci/cli/tests/test_org.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,9 @@ def get_org(orgname):
887887

888888
run_click_command(org.org_list, runtime=runtime, json_flag=False, plain=False)
889889

890-
assert "Cannot load org config for `test1`" in str(
890+
assert "Cannot load org config for `test1`" in str(echo.mock_calls), (
891891
echo.mock_calls
892-
), echo.mock_calls
892+
)
893893
assert "NOPE!" in str(echo.mock_calls), echo.mock_calls
894894
assert "Cannot cleanup org cache dirs" in str(echo.mock_calls), echo.mock_calls
895895

0 commit comments

Comments
 (0)