Skip to content

Commit

Permalink
Fix CMakeFormat task (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Nov 30, 2023
1 parent 1469a0d commit 7428e60
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions wpiformat/wpiformat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ def main():
task_pipeline = [
BraceComment(),
CIdentList(),
CMakeFormat(),
EofNewline(),
GTestName(),
IncludeGuard(),
Expand All @@ -498,10 +497,34 @@ def main():
ClangFormat(args.clang_version),
Jni(), # Fixes clang-format formatting
]

# Check tasks are all pipeline tasks
invalid_tasks = [
type(task).__name__
for task in task_pipeline
# Pipeline tasks must override run_pipeline
if Task.run_pipeline == type(task).run_pipeline
]
if invalid_tasks:
print(f"error: the following pipeline tasks are invalid: {invalid_tasks}")
return False

run_pipeline(task_pipeline, args, files)

# Lint is run last since previous tasks can affect its output.
task_pipeline = [PyFormat(), Lint()]
task_pipeline = [CMakeFormat(), PyFormat(), Lint()]

# Check tasks are all batch tasks
invalid_tasks = [
type(task).__name__
for task in task_pipeline
# Batch tasks must override run_batch
if Task.run_batch == type(task).run_batch
]
if invalid_tasks:
print(f"error: the following batch tasks are invalid: {invalid_tasks}")
return False

run_batch(task_pipeline, args, file_batches)

# ClangTidy is run last of all; it needs the actual files
Expand Down

0 comments on commit 7428e60

Please sign in to comment.