mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2026-04-07 10:22:21 +00:00
Merge branch 'idf' of github.com:HendrikRauh/dmx-interface into idf
This commit is contained in:
commit
2fc170bc84
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)
|
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."})
|
@task(help={"o": "Open documentation in the default browser after generation."})
|
||||||
def docs(c, o=False):
|
def docs(c, o=False):
|
||||||
"""Generate Doxygen documentation."""
|
"""Generate Doxygen documentation."""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue