summaryrefslogtreecommitdiffstatshomepage
path: root/tools/codeformat.py
Commit message (Collapse)AuthorAge
* all: Replace "black" with "ruff format".Jim Mussared2023-11-03
| | | | | | | | | | | | | - Add config for [tool.ruff.format] to pyproject.toml. - Update pre-commit to run both ruff and ruff-format (and only check C files when running codeformat.py) - Update CI. - Simplify codeformat.py to remove all the Python-specific logic (just run "ruff format" directly). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* teensy: Remove the teensy port.Jim Mussared2023-10-31
| | | | | | | | | | This port is largely unmaintained, has limited features (the only hardware support is for GPIO and timer, and no machine module), only supports a small number of Teensy boards, and can be confused with the mimxrt support for Teensy 4.x. Signed-off-by: Jim Mussared <jim.mussared@gmail.com> Signed-off-by: Damien George <damien@micropython.org>
* tools/codeformat.py: Use pyproject.toml for black config.Jos Verlinde2023-08-10
| | | | Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
* tools/codeformat.py: Skip formatting ESP-IDF managed components.Daniël van de Giessen2023-08-10
| | | | Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
* all: Rename *umodule*.c to remove the "u" prefix.Jim Mussared2023-06-08
| | | | | | | | | | | Updates any includes, and references from Makefiles/CMake. This essentially reverts what was done long ago in commit 136b5cbd7669e8318f8455fc2706da97a5b7994c This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
* shared/tinyusb: Further refactor static USB device implementation.Angus Gratton2022-11-11
| | | | | | | | | | | | App the mp_ prefix to usbd_ symbols and files which are defined here and not in TinyUSB. rp2 only for now. This includes some groundwork for dynamic USB devices (defined in Python). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
* tools: Add pre-commit support.Angus Gratton2022-10-04
| | | | | | | | | | | | Tweak the existing codeformat.py and verifygitlog.py to allow them to be easily called by pre-commit. (This turned out to be easier than using any existing pre-commit hooks, without making subtle changes in the formatting.) This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
* tools/codeformat.py: Include more ports .c/.h files in formatting.Damien George2022-04-20
| | | | | | | | This adds a rule to cover all ports/**/*.[ch] file to the code formatting list. Explicit exclusions are also added for code in ports/ which is third party, or which requires a lot of reformatting. Signed-off-by: Damien George <damien@micropython.org>
* tools/codeformat.py: Remove ports/unix/*.py from exclusion list.Damien George2022-04-20
| | | | | | | These .py files were removed from the .gitignore in commit 3c2aa5ff93a3b12723c7ca794aa9c583891c349b Signed-off-by: Damien George <damien@micropython.org>
* drivers/ninaw10: Add ublox Nina-W10 WiFi/BT module driver.iabdalkader2021-11-13
| | | | | - Add WiFi/BT drivers for ublox Nina-W10 (esp32 based) module. - Add ublox Nina-W10 Python module in extmod.
* mimxrt: Rework flash configuration.Philipp Ebensberger2021-09-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Moves definition of BOARD_FLASH_SIZE and other header files related to flash configuration into the Makefile. - Adds board specific clock_config.h. - Adds board.h, pin_mux.h, and peripherals.h as they are required by NXP MCU SDK in order to use our own clock_config.h. - Renames board specific FlexSPI configuration files. - Updates flash frequency of MIMXRT1020_EVK - Creates separated flash_config files for QSPI NOR and QSPI Hyper flash. - Unifies VFS start address to be @ 1M for 1010 and 1020 boards. - Unifies 1050EVK boards - Adds support to both NOR and HyperFlash on boards with both capabilities. - Adds automatic FlexRAM initialization to start-up code based on linker script and NXP HAL. - Applies code formatting to all files in mimxrt port. With this change the flash configuration is restructured and organized. This simplifies the configuration process and provides a better overview of each board's settings. With the integration of clock_config.h, board.h, pin_mux.h, and peripherals.h we gain better control of the settings and clock configurations. Furthermore the implementation of an explicit FlexRAM setup improves the system performance and allows for performance tuning. Signed-off-by: Philipp Ebensberger
* tools/codeformat.py: Include ports/nrf/modules/nrf in code formatting.Glenn Ruben Bakke2021-08-08
|
* all: Update to point to files in new shared/ directory.Damien George2021-07-12
| | | | Signed-off-by: Damien George <damien@micropython.org>
* lib/mbedtls_errors: Add code to patch mbedtls for shortened error strs.Thorsten von Eicken2020-07-20
| | | | | | The file `mbedtls_errors/mp_mbedtls_errors.c` can be used instead of `mbedtls/library/error.c` to give shorter error strings, reducing the build size of the error strings from about 12-16kB down to about 2-5kB.
* tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.Damien George2020-06-18
| | | | Signed-off-by: Damien George <damien@micropython.org>
* tools/codeformat.py: Remove sizeof fixup.David Lechner2020-06-14
| | | | | | | | | Formatting for `* sizeof` was fixed in uncrustify v0.71, so we no longer need the fixups for it. Also, there was one file where the updated uncrustify caught a problem that the regex didn't pick up, which is updated in this commit. Signed-off-by: David Lechner <david@pybricks.com>
* tools/codeformat.py: Add verbose option to pass to uncrustify and black.David Lechner2020-05-29
| | | | | | | | | | This adds a new command line option `-v` to `tools/codeformat.py` to enable verbose printing of all files that are scanned. Normally `uncrustify` and `black` are called with the `-q` option so setting verbose suppresses the `-q` option and on `black` also enables the `-v` option which makes it print out all file names matching the filter similar to how `uncrustify` does by default.
* tools/codeformat.py: Use -q option on uncrustify to make output quiet.David Lechner2020-05-28
| | | | | | This suppresses the Parsing: <file> as language C lines. This makes parsing run a bit faster and on CI it makes for less scrolling through logs (and black already uses the -q option).
* tests: Format all Python code with black, except tests in basics subdir.David Lechner2020-03-30
| | | | | | | | | | This adds the Python files in the tests/ directory to be formatted with ./tools/codeformat.py. The basics/ subdirectory is excluded for now so we aren't changing too much at once. In a few places `# fmt: off`/`# fmt: on` was used where the code had special formatting for readability or where the test was actually testing the specific formatting.
* tools/codeformat.py: Include all msvc C code in auto-format.stijn2020-03-25
|
* tools/codeformat.py: Eliminate need for sizeof fixup.David Lechner2020-03-11
| | | | | | | | | This eliminates the need for the sizeof regex fixup by rearranging things a bit. All other bitfields already use the parentheses around expressions with sizeof, so one case is fixed by following this convention. VM_MAX_STATE_ON_STACK is the only remaining problem and it can be worked around by changing the order of the operands.
* tools/codeformat.py: Add formatter using uncrustify for C, black for Py.Damien George2020-02-28
This commit adds a tool, codeformat.py, which will reformat C and Python code to fit a certain style. By default the tool will reformat (almost) all the original (ie not 3rd-party) .c, .h and .py files in this repository. Passing filenames on the command-line to codeformat.py will reformat only those. Reformatting is done in-place. uncrustify is used for C reformatting, which is available for many platforms and can be easily built from source, see https://github.com/uncrustify/uncrustify. The configuration for uncrustify is also added in this commit and values are chosen to best match the existing code style. A small post-processing stage on .c and .h files is done by codeformat.py (after running uncrustify) to fix up some minor items: - space inserted after * when used as multiplication with sizeof - #if/ifdef/ifndef/elif/else/endif are dedented by one level when they are configuring if-blocks and case-blocks. For Python code, the formatter used is black, which can be pip-installed; see https://github.com/psf/black. The defaults are used, except for line- length which is set at 99 characters to match the "about 100" line-length limit used in C code. The formatting tools used and their configuration were chosen to strike a balance between keeping existing style and not changing too many lines of code, and enforcing a relatively strict style (especially for Python code). This should help to keep the code consistent across everything, and reduce cognitive load when writing new code to match the style.