MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / main

Function main

scripts/sanitize-commit.py:149–206  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147
148
149def main() -> int:
150 root = repo_root()
151 os.chdir(root)
152
153 sanitize_permissions(root)
154
155 run_python_step(
156 "Expanding single-line doxygen comments", root / "scripts" / "expand-doxygen.py"
157 )
158
159 print("Running clang-format (pass 1)...")
160 run_clang_format(root)
161
162 run_python_step("Running code-verify", root / "scripts" / "code-verify.py", "--fix")
163
164 print("Running clang-format (pass 2)...")
165 run_clang_format(root)
166
167 run_python_step_quiet(
168 "Regenerating .code-report", root / "scripts" / "code-verify.py", "--check"
169 )
170
171 run_black(root)
172
173 run_python_step(
174 "Running documentation-verify",
175 root / "scripts" / "documentation-verify.py",
176 "--quiet",
177 )
178
179 run_python_step(
180 "Regenerating SerialStudio SDK (JS/Lua)",
181 root / "scripts" / "generate-sdk.py",
182 )
183
184 run_python_step(
185 "Rebuilding AI search index",
186 root / "app" / "rcc" / "ai" / "build_search_index.py",
187 )
188
189 print("Checking for changes...")
190 changed = capture(["git", "status", "--short"])
191 if not changed.strip():
192 print("No changes detected.")
193 return 0
194
195 print()
196 print("Changed files:")
197 sys.stdout.write(changed)
198 print()
199
200 staged = capture(["git", "diff", "--cached", "--name-only"]).splitlines()
201 count = len(staged)
202 if count == 0:
203 count = len(capture(["git", "diff", "--name-only"]).splitlines())
204 print(f"{count} file(s) changed. Review and commit when ready.")
205
206 return 0

Callers 1

sanitize-commit.pyFile · 0.70

Calls 8

repo_rootFunction · 0.85
sanitize_permissionsFunction · 0.85
run_python_stepFunction · 0.85
run_clang_formatFunction · 0.85
run_python_step_quietFunction · 0.85
run_blackFunction · 0.85
captureFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected