Skip to content

Commit

Permalink
tools: codeformat.py
Browse files Browse the repository at this point in the history
New code formatter based on upstream.
  • Loading branch information
dlech committed May 17, 2020
1 parent fd3f098 commit 842fff3
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tools/codeformat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env python3

import importlib.util
import os

# import codeformat from upstream micropython tools
spec = importlib.util.spec_from_file_location(
"codeformat",
os.path.join(os.path.dirname(__file__), "..", "..", "..", "tools", "codeformat.py"),
)
codeformat = importlib.util.module_from_spec(spec)
spec.loader.exec_module(codeformat)

# override with Pybricks paths

codeformat.PATHS = [
"ports/pybricks/bricks/**/*.[ch]",
"ports/pybricks/extmod/*.[ch]",
"ports/pybricks/lib/pbio/**/*.[ch]",
"ports/pybricks/py/*.[ch]",
# Python
"ports/pybricks/bricks/**/*.py",
"ports/pybricks/tests/**/*.py",
"ports/pybricks/tools/**/*.py",
]

codeformat.EXCLUSIONS = [
"ports/pybricks/bricks/nxt/nxt-firmware-drivers/**/*.[ch]",
"ports/pybricks/bricks/*/build*/**/*.[ch]",
]

if __name__ == "__main__":
codeformat.main()

0 comments on commit 842fff3

Please sign in to comment.