Skip to content

Commit aec80dc

Browse files
T-256zanieb
andauthored
Ruff ecosystem: pass no-preview cli arg by default (astral-sh#8775)
Addresses astral-sh#8489 (comment) That issues still exist on formatter, but since `black` doesn't support `no-preview` cli arg, I didn't include it in this PR. --------- Co-authored-by: Zanie <contact@zanie.dev>
1 parent 10d937c commit aec80dc

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

‎.github/workflows/ci.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
- "!crates/ruff_shrinking/**"
4545
- scripts/*
4646
- .github/workflows/ci.yaml
47+
- python/**
4748
4849
formatter:
4950
- Cargo.toml
@@ -58,6 +59,7 @@ jobs:
5859
- crates/ruff_python_parser/**
5960
- crates/ruff_dev/**
6061
- scripts/*
62+
- python/**
6163
- .github/workflows/ci.yaml
6264
6365
cargo-fmt:

‎python/ruff-ecosystem/ruff_ecosystem/projects.py‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,12 @@ class CheckOptions(CommandOptions):
7171
max_lines_per_rule: int | None = 50
7272

7373
def to_ruff_args(self) -> list[str]:
74-
args = ["check", "--no-cache", "--exit-zero"]
74+
args = [
75+
"check",
76+
"--no-cache",
77+
"--exit-zero",
78+
f"--{'' if self.preview else 'no-'}preview",
79+
]
7580
if self.select:
7681
args.extend(["--select", self.select])
7782
if self.ignore:
@@ -80,8 +85,6 @@ def to_ruff_args(self) -> list[str]:
8085
args.extend(["--exclude", self.exclude])
8186
if self.show_fixes:
8287
args.extend(["--show-fixes", "--ecosystem-ci"])
83-
if self.preview:
84-
args.append("--preview")
8588
return args
8689

8790

@@ -95,11 +98,9 @@ class FormatOptions(CommandOptions):
9598
exclude: str = ""
9699

97100
def to_ruff_args(self) -> list[str]:
98-
args = ["format"]
101+
args = ["format", f"--{'' if self.preview else 'no-'}preview"]
99102
if self.exclude:
100103
args.extend(["--exclude", self.exclude])
101-
if self.preview:
102-
args.append("--preview")
103104
return args
104105

105106
def to_black_args(self) -> list[str]:

0 commit comments

Comments
 (0)