mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2026-04-07 10:22:21 +00:00
refactor(tasks): remove format_check task
This commit is contained in:
parent
2f8948954c
commit
a42a0cafc6
1 changed files with 0 additions and 54 deletions
54
tasks.py
54
tasks.py
|
|
@ -96,60 +96,6 @@ def format(c):
|
|||
c.run("pre-commit run --all-files", pty=True)
|
||||
|
||||
|
||||
@task
|
||||
def format_check(c):
|
||||
"""Check if all files are formatted correctly"""
|
||||
missing_tools = []
|
||||
format_errors = []
|
||||
|
||||
print("Checking C file formatting...")
|
||||
result = c.run(
|
||||
"find main components -name '*.c' -o -name '*.h' | xargs clang-format --dry-run --Werror",
|
||||
warn=True,
|
||||
)
|
||||
if result:
|
||||
if result.return_code == 127: # Command not found
|
||||
missing_tools.append("clang-format")
|
||||
elif not result.ok:
|
||||
format_errors.append("C files")
|
||||
|
||||
print("Checking Python file formatting...")
|
||||
result = c.run("black --check tasks.py", warn=True)
|
||||
if result:
|
||||
if result.return_code == 127:
|
||||
missing_tools.append("black")
|
||||
elif not result.ok:
|
||||
format_errors.append("Python files")
|
||||
|
||||
print("Checking Nix file formatting...")
|
||||
result = c.run("nixfmt --check flake.nix", warn=True)
|
||||
if result:
|
||||
if result.return_code == 127:
|
||||
missing_tools.append("nixfmt")
|
||||
elif not result.ok:
|
||||
format_errors.append("Nix files")
|
||||
|
||||
print("Checking other file formatting...")
|
||||
result = c.run("prettier --check '**/*.{js,json,yaml,yml,md,html,css}'", warn=True)
|
||||
if result:
|
||||
if result.return_code == 127:
|
||||
missing_tools.append("prettier")
|
||||
elif not result.ok:
|
||||
format_errors.append("JS/JSON/YAML/HTML/CSS files")
|
||||
|
||||
if missing_tools:
|
||||
print(f"\n❌ ERROR: Missing formatting tools: {', '.join(missing_tools)}")
|
||||
print("Please install them or reload the nix-shell.")
|
||||
sys.exit(1)
|
||||
|
||||
if format_errors:
|
||||
print(f"\n❌ ERROR: Formatting issues in: {', '.join(format_errors)}")
|
||||
print("Run 'invoke format' to fix them.")
|
||||
sys.exit(1)
|
||||
|
||||
print("\n✅ All files are correctly formatted!")
|
||||
|
||||
|
||||
@task(help={"o": "Open documentation in the default browser after generation."})
|
||||
def docs(c, o=False):
|
||||
"""Generate Doxygen documentation."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue