Use `FormatOptions`; exclude file from `demisto/content` with syntax error

This commit is contained in:
Zanie 2023-10-27 15:46:33 -05:00
parent 7d5122603e
commit 16e511a734
2 changed files with 14 additions and 4 deletions

View File

@ -1,7 +1,7 @@
"""
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
DEFAULT_TARGETS = [
@ -22,7 +22,13 @@ DEFAULT_TARGETS = [
check_options=CheckOptions(select="ALL"),
),
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="freedomofpress", name="securedrop", ref="develop")),
Project(repo=Repository(owner="fronzbot", name="blinkpy", ref="dev")),

View File

@ -154,7 +154,7 @@ async def ruff_format(
) -> Sequence[str]:
"""Run the given ruff binary against the specified path."""
logger.debug(f"Formatting {name} with {executable}")
ruff_args = ["format"]
ruff_args = options.to_cli_args()
if diff:
ruff_args.append("--diff")
@ -186,6 +186,10 @@ class FormatOptions:
Ruff format options.
"""
exclude: str = ""
def to_cli_args(self) -> list[str]:
args = ["format", "--diff"]
args = ["format"]
if self.exclude:
args.extend(["--exclude", self.exclude])
return args