mirror of https://github.com/astral-sh/ruff
Use `FormatOptions`; exclude file from `demisto/content` with syntax error
This commit is contained in:
parent
7d5122603e
commit
16e511a734
|
|
@ -1,7 +1,7 @@
|
||||||
"""
|
"""
|
||||||
Default projects for ecosystem checks
|
Default projects for ecosystem checks
|
||||||
"""
|
"""
|
||||||
from ruff_ecosystem.projects import CheckOptions, Project, Repository
|
from ruff_ecosystem.projects import CheckOptions, Project, Repository, FormatOptions
|
||||||
|
|
||||||
# TODO(zanieb): Consider exporting this as JSON and loading from there instead
|
# TODO(zanieb): Consider exporting this as JSON and loading from there instead
|
||||||
DEFAULT_TARGETS = [
|
DEFAULT_TARGETS = [
|
||||||
|
|
@ -22,7 +22,13 @@ DEFAULT_TARGETS = [
|
||||||
check_options=CheckOptions(select="ALL"),
|
check_options=CheckOptions(select="ALL"),
|
||||||
),
|
),
|
||||||
Project(repo=Repository(owner="commaai", name="openpilot", ref="master")),
|
Project(repo=Repository(owner="commaai", name="openpilot", ref="master")),
|
||||||
Project(repo=Repository(owner="demisto", name="content", ref="master")),
|
Project(
|
||||||
|
repo=Repository(owner="demisto", name="content", ref="master"),
|
||||||
|
format_options=FormatOptions(
|
||||||
|
# Syntax errors in this file
|
||||||
|
exclude="Packs/ThreatQ/Integrations/ThreatQ/ThreatQ.py"
|
||||||
|
),
|
||||||
|
),
|
||||||
Project(repo=Repository(owner="docker", name="docker-py", ref="main")),
|
Project(repo=Repository(owner="docker", name="docker-py", ref="main")),
|
||||||
Project(repo=Repository(owner="freedomofpress", name="securedrop", ref="develop")),
|
Project(repo=Repository(owner="freedomofpress", name="securedrop", ref="develop")),
|
||||||
Project(repo=Repository(owner="fronzbot", name="blinkpy", ref="dev")),
|
Project(repo=Repository(owner="fronzbot", name="blinkpy", ref="dev")),
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ async def ruff_format(
|
||||||
) -> Sequence[str]:
|
) -> Sequence[str]:
|
||||||
"""Run the given ruff binary against the specified path."""
|
"""Run the given ruff binary against the specified path."""
|
||||||
logger.debug(f"Formatting {name} with {executable}")
|
logger.debug(f"Formatting {name} with {executable}")
|
||||||
ruff_args = ["format"]
|
ruff_args = options.to_cli_args()
|
||||||
|
|
||||||
if diff:
|
if diff:
|
||||||
ruff_args.append("--diff")
|
ruff_args.append("--diff")
|
||||||
|
|
@ -186,6 +186,10 @@ class FormatOptions:
|
||||||
Ruff format options.
|
Ruff format options.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
exclude: str = ""
|
||||||
|
|
||||||
def to_cli_args(self) -> list[str]:
|
def to_cli_args(self) -> list[str]:
|
||||||
args = ["format", "--diff"]
|
args = ["format"]
|
||||||
|
if self.exclude:
|
||||||
|
args.extend(["--exclude", self.exclude])
|
||||||
return args
|
return args
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue