Ruff ecosystem: pass no-preview cli arg by default (#8775)

Addresses
https://github.com/astral-sh/ruff/pull/8489#issuecomment-1793513411
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>
This commit is contained in:
T-256 2023-11-20 21:51:51 +03:30 committed by GitHub
parent 10d937c1a1
commit aec80dc3ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -71,7 +71,12 @@ class CheckOptions(CommandOptions):
max_lines_per_rule: int | None = 50
def to_ruff_args(self) -> list[str]:
args = ["check", "--no-cache", "--exit-zero"]
args = [
"check",
"--no-cache",
"--exit-zero",
f"--{'' if self.preview else 'no-'}preview",
]
if self.select:
args.extend(["--select", self.select])
if self.ignore:
@ -80,8 +85,6 @@ class CheckOptions(CommandOptions):
args.extend(["--exclude", self.exclude])
if self.show_fixes:
args.extend(["--show-fixes", "--ecosystem-ci"])
if self.preview:
args.append("--preview")
return args
@ -95,11 +98,9 @@ class FormatOptions(CommandOptions):
exclude: str = ""
def to_ruff_args(self) -> list[str]:
args = ["format"]
args = ["format", f"--{'' if self.preview else 'no-'}preview"]
if self.exclude:
args.extend(["--exclude", self.exclude])
if self.preview:
args.append("--preview")
return args
def to_black_args(self) -> list[str]: