summaryrefslogtreecommitdiffstatshomepage
path: root/tools/uncrustify.cfg
Commit message (Collapse)AuthorAge
* all: Fix spelling mistakes based on codespell check.Damien George2023-04-27
| | | | Signed-off-by: Damien George <damien@micropython.org>
* tools: Add note about uncrustify versions.Angus Gratton2022-10-04
| | | | | | | | | | | | | | | | | | Uncrustify versions are not mutually compatible: 1. Version 0.73 or newer produce slightly different formatting. It may be possible to tweak these by adding more config items, but this will cause older versions to error out with 'Unknown option'. 2. Version 0.75 prints a range of deprecation warnings due to config file changes, and returns a non-zero exit code. These are actually fixable as most are the default value, and pp_indent has changed from 'true' to '1' which is backwards compatible. However issue 1 remains, so probably better to have it fail explicitly. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
* tools/uncrustify: Make sure a space exists after a comma.Damien George2022-05-05
| | | | | | | This will add a space after a comma if it doesn't have one, but will allow more than one space if the spaces are already there. Signed-off-by: Damien George <damien@micropython.org>
* tools/uncrustify: Force 1 newline at end of file.David Lechner2021-08-31
| | | | | | | To keep things neat and tidy, we ensure that each file has 1 and only 1 newline at the end of each file. Signed-off-by: David Lechner <david@pybricks.com>
* tools/uncrustify: Enable more opts to remove space between func and '('.David Lechner2020-06-19
| | | | | | With only `sp_func_proto_paren = remove` set there are some cases where uncrustify misses removing a space between the function name and the opening '('. This sets all of the related options to `force` as well.
* tools/uncrustify: Update config for v0.71.0.David Lechner2020-06-14
| | | | | | | | | | | | | | This is the result of running... uncrustify -c tools/uncrustify.cfg --update-config-with-doc -o tools/uncrustify.cfg ...with some manual fixups to correct places where it changed things it should not have. Essentially it just adds new config parameters introduced in v0.71.0 with their default values. Signed-off-by: David Lechner <david@pybricks.com>
* tools/uncrustify.cfg: Remove deprecated sp_word_brace option.David Lechner2020-06-14
| | | | | | This option was removed in uncrustify v0.71. Signed-off-by: David Lechner <david@pybricks.com>
* all: Format code to add space after C++-style comment start.stijn2020-04-23
| | | | | | Note: the uncrustify configuration is explicitly set to 'add' instead of 'force' in order not to alter the comments which use extra spaces after // as a means of indenting text for clarity.
* all: Remove spaces inside and around parenthesis.Damien George2020-03-28
| | | | Using new options enabled in the uncrustify configuration.
* all: Remove spaces between nested paren and inside function arg paren.Damien George2020-03-25
| | | | Using new options enabled in the uncrustify configuration.
* 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.