You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BUILDING.md
+20
Original file line number
Diff line number
Diff line change
@@ -85,3 +85,23 @@ Example:
85
85
86
86
If your port/build includes `arm-none-eabi-gdb-py`, consider using it instead, as it can be used for better register
87
87
debugging with https://github.com/bnahill/PyCortexMDebug
88
+
89
+
# Code Quality Checks
90
+
91
+
We apply code quality checks using pre-commit. Install pre-commit once per system with
92
+
93
+
python3 -mpip install pre-commit
94
+
95
+
Activate it once per git clone with
96
+
97
+
pre-commit --install
98
+
99
+
Pre-commit also requires some additional programs to be installed through your package manager:
100
+
101
+
* Standard Unix tools such as make, find, etc
102
+
* The gettext package, any modern version
103
+
* uncrustify version 0.71 (0.72 is also tested)
104
+
105
+
Each time you create a git commit, the pre-commit quality checks will be run. You can also run them e.g., with `pre-commit run foo.c` or `pre-commit run --all` to run on all files whether modified or not.
106
+
107
+
Some pre-commit quality checks require your active attention to resolve, others (such as the formatting checks of uncrustify) are made automatically and must simply be incorporated into your code changes by committing them.
GitHub doesn't currently support code search on forks. Therefore, CircuitPython doesn't have code search through GitHub because it is a fork of MicroPython. Luckily, `SourceGraph <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ has free code search for public repos like CircuitPython. So, visit `sourcegraph.com/github.com/adafruit/circuitpython <https://sourcegraph.com/github.com/adafruit/circuitpython>`_ to search the CircuitPython codebase online.
57
+
54
58
Contributing
55
59
------------
56
60
@@ -113,10 +117,9 @@ Behavior
113
117
- ``code.py`` (or ``main.py``) is run after every reload until it
114
118
finishes or is interrupted. After it is done running, the vm and
115
119
hardware is reinitialized. **This means you cannot read state from**
116
-
``code.py`` **in the REPL anymore.** CircuitPython's goal for this
120
+
``code.py`` **in the REPL anymore, as the REPL is a fresh vm.** CircuitPython's goal for this
117
121
change includes reducing confusion about pins and memory being used.
118
-
- After ``code.py`` the REPL can be entered by pressing any key. It no
119
-
longer shares state with ``code.py`` so it is a fresh vm.
122
+
- After the main code is finished the REPL can be entered by pressing any key.
120
123
- Autoreload state will be maintained across reload.
121
124
- Adds a safe mode that does not run user code after a hard crash or
122
125
brown out. The hope is that this will make it easier to fix code that
@@ -126,8 +129,7 @@ Behavior
126
129
- RGB status LED indicating CircuitPython state, and errors through a sequence of colored flashes.
127
130
- Re-runs ``code.py`` or other main file after file system writes over USB mass storage. (Disable with
128
131
``supervisor.disable_autoreload()``)
129
-
- Entering the REPL after the main code is finished requires a key press which enters the REPL and
130
-
disables autoreload.
132
+
- Autoreload is disabled while the REPL is active.
131
133
- Main is one of these: ``code.txt``, ``code.py``, ``main.py``,
132
134
``main.txt``
133
135
- Boot is one of these: ``settings.txt``, ``settings.py``, ``boot.py``,
0 commit comments