MCPcopy Create free account
hub / github.com/FastLED/FastLED / run_rust_linter

Function run_rust_linter

ci/lint_cpp/rust_bridge.py:94–138  ·  view source on GitHub ↗

Run the Rust linter and return results in the Python linter shape.

(files: list[str] | None)

Source from the content-addressed store, hash-verified

92
93
94def run_rust_linter(files: list[str] | None) -> dict[str, CheckerResults]:
95 """Run the Rust linter and return results in the Python linter shape."""
96 cmd = [
97 "soldr",
98 "cargo",
99 "run",
100 "--release",
101 "--bin",
102 "fastled-lint",
103 "--manifest-path",
104 "ci/lint_cpp_rs/Cargo.toml",
105 "--",
106 "--format",
107 "json",
108 "--project-root",
109 str(PROJECT_ROOT),
110 ]
111
112 if files:
113 cmd.extend(files)
114
115 result = RunningProcess.run(
116 cmd,
117 cwd=str(PROJECT_ROOT),
118 capture_output=True,
119 check=False,
120 timeout=300,
121 )
122
123 if result.stderr:
124 print(
125 result.stderr,
126 file=sys.stderr,
127 end="" if result.stderr.endswith("\n") else "\n",
128 )
129
130 if result.returncode not in (0, 1):
131 raise RuntimeError(
132 "Rust C++ linter failed before producing lint results "
133 f"(exit {result.returncode})"
134 )
135
136 raw_violations = parse_rust_json_output(result.stdout)
137
138 return _violations_to_results(raw_violations)
139
140
141def parse_rust_json_output(stdout: str | None) -> list[dict[str, Any]]:

Callers 2

mainFunction · 0.90
run_rust_ab_checkFunction · 0.85

Calls 4

parse_rust_json_outputFunction · 0.85
_violations_to_resultsFunction · 0.85
printFunction · 0.50
runMethod · 0.45

Tested by

no test coverage detected