MCPcopy Create free account
hub / github.com/catboost/catboost / run_ruff

Function run_ruff

tools/ruff_linter/wrapper.py:33–48  ·  view source on GitHub ↗
(ruff_bin: str, cmd_args: list[str], filename: str, config: Path)

Source from the content-addressed store, hash-verified

31
32
33def run_ruff(ruff_bin: str, cmd_args: list[str], filename: str, config: Path) -> list[str]:
34 # XXX: `--no-cache` is important when we run ruff in source root and don't want to pollute arcadia
35 cmd = [ruff_bin, *cmd_args, '--no-cache', '--config', config, filename]
36 res = subprocess.run(
37 cmd,
38 capture_output=True,
39 encoding='utf8',
40 errors='replace',
41 env=dict(os.environ.copy(), RUFF_OUTPUT_FORMAT='concise'),
42 # When config is passed through `--config`, `exclude` starts searching from cwd
43 # so set cwd to config cwd to mimic behavior of autodiscovery.
44 # Note that it stops being accurate when `extend` is used.
45 # https://docs.astral.sh/ruff/configuration/#config-file-discovery
46 cwd=os.path.dirname(config),
47 )
48 return res.stdout.splitlines(keepends=True) if res.returncode else []
49
50
51def process_file(

Callers 1

process_fileFunction · 0.85

Calls 3

dictClass · 0.85
runMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected