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

Function main

ci/lint_python/subprocess_capture_checker.py:140–172  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

138
139
140def main(argv: list[str] | None = None) -> int:
141 parser = argparse.ArgumentParser(
142 description="Check Python files for subprocess.run with capture_output/PIPE.",
143 )
144 parser.add_argument(
145 "paths",
146 nargs="+",
147 help="Files or directories to check",
148 )
149 parser.add_argument(
150 "--exclude",
151 nargs="*",
152 default=[],
153 help="Substrings to exclude from file paths",
154 )
155 args = parser.parse_args(argv)
156
157 files = collect_python_files(args.paths, args.exclude)
158
159 total_violations = 0
160 for path in files:
161 try:
162 source = path.read_text(encoding="utf-8", errors="replace")
163 except OSError:
164 continue
165 if not _SUBPROCESS_RE.search(source):
166 continue
167 violations = check_file(str(path), source)
168 for line_no, message in violations:
169 print(f"{path}:{line_no}: {message}")
170 total_violations += 1
171
172 return 1 if total_violations > 0 else 0
173
174
175if __name__ == "__main__":

Callers 1

Calls 4

parse_argsMethod · 0.80
collect_python_filesFunction · 0.70
check_fileFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected