-
Couldn't load subscription status.
- Fork 94
Switch to uncrustify #517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Switch to uncrustify #517
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| # Uncrustify-0.80.1_f | ||
|
|
||
| # The original size of tabs in the input. | ||
| # | ||
| # Default: 8 | ||
| input_tab_size = 4 # unsigned number | ||
|
|
||
| # The size of tabs in the output (only used if align_with_tabs=true). | ||
| # | ||
| # Default: 8 | ||
| output_tab_size = 4 # unsigned number | ||
|
|
||
| # Add or remove space between 'while' and '('. | ||
| sp_while_paren_open = add # ignore/add/remove/force | ||
|
|
||
| # Add or remove space around boolean operators '&&' and '||'. | ||
| sp_bool = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space inside '(' and ')'. | ||
| sp_inside_paren = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between nested parentheses, i.e. '((' vs. ') )'. | ||
| sp_paren_paren = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between ')' and '{'. | ||
| sp_paren_brace = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between pointer stars '*'. | ||
| sp_between_ptr_star = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before '<'. | ||
| sp_before_angle = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space inside '<' and '>'. | ||
| sp_inside_angle = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space after '>'. | ||
| sp_after_angle = add # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between '>' and '(' as found in 'new List<byte>(foo);'. | ||
| sp_angle_paren = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between '>' and a word as in 'List<byte> m;' or | ||
| # 'template <typename T> static ...'. | ||
| sp_angle_word = add # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between '>' and '>' in '>>' (template stuff). | ||
| # | ||
| # Default: add | ||
| sp_angle_shift = ignore # ignore/add/remove/force | ||
|
|
||
| # (C++11) Permit removal of the space between '>>' in 'foo<bar<int> >'. Note | ||
| # that sp_angle_shift cannot remove the space without this option. | ||
| sp_permit_cpp11_shift = true # true/false | ||
|
|
||
| # Add or remove space before '(' of control statements ('if', 'for', 'switch', | ||
| # 'while', etc.). | ||
| sp_before_sparen = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space inside '(' and ')' of control statements. | ||
| sp_inside_sparen = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space after ')' of control statements. | ||
| sp_after_sparen = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between ')' and '{' of of control statements. | ||
| sp_sparen_brace = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before ';' in non-empty 'for' statements. | ||
| sp_before_semi_for = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space after the final semicolon of an empty part of a for | ||
| # statement, as in 'for ( ; ; <here> )'. | ||
| sp_after_semi_for_empty = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before '[]'. | ||
| sp_before_squares = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before C++17 structured bindings. | ||
| sp_cpp_before_struct_binding = ignore # ignore/add/remove/force | ||
|
|
||
| # Add or remove space inside a non-empty '[' and ']'. | ||
| sp_inside_square = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space after class ':'. | ||
| sp_after_class_colon = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before class ':'. | ||
| sp_before_class_colon = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space inside '{}'. | ||
| sp_inside_braces_empty = remove # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between 'else' and '{' if on the same line. | ||
| sp_else_brace = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between '}' and 'else' if on the same line. | ||
| sp_brace_else = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space before the '{' of a 'catch' statement, if the '{' and | ||
| # 'catch' are on the same line, as in 'catch (decl) <here> {'. | ||
| sp_catch_brace = force # ignore/add/remove/force | ||
|
|
||
| # Add or remove space between '}' and 'catch' if on the same line. | ||
| sp_brace_catch = force # ignore/add/remove/force | ||
|
|
||
| # The number of columns to indent per level. Usually 2, 3, 4, or 8. | ||
| # | ||
| # Default: 8 | ||
| indent_columns = 4 # unsigned number | ||
|
|
||
| # How to use tabs when indenting code. | ||
| # | ||
| # 0: Spaces only | ||
| # 1: Indent with tabs to brace level, align with spaces (default) | ||
| # 2: Indent and align with tabs, using spaces when not on a tabstop | ||
| # | ||
| # Default: 1 | ||
| indent_with_tabs = 0 # unsigned number | ||
|
|
||
| # Whether to indent the body of a 'namespace'. | ||
| indent_namespace = true # true/false | ||
|
|
||
| # Whether the 'class' body is indented. | ||
| indent_class = true # true/false | ||
|
|
||
| # How to indent access specifiers that are followed by a | ||
| # colon. | ||
| # | ||
| # >0: Absolute column where 1 is the leftmost column | ||
| # <=0: Subtract from brace indent | ||
| # | ||
| # Default: 1 | ||
| indent_access_spec = -4 # number | ||
|
|
||
| # Whether to collapse empty blocks between '{' and '}' except for functions. | ||
| # Use nl_collapse_empty_body_functions to specify how empty function braces | ||
| # should be formatted. | ||
| nl_collapse_empty_body = true # true/false | ||
|
|
||
| # Whether to collapse empty blocks between '{' and '}' for functions only. | ||
| # If true, overrides nl_inside_empty_func. | ||
| nl_collapse_empty_body_functions = true # true/false | ||
|
|
||
| # Whether to convert all tabs to spaces in comments. If false, tabs in | ||
| # comments are left alone, unless used for indenting. | ||
| cmt_convert_tab_to_spaces = true # true/false | ||
|
|
||
| # An offset value that controls the indentation of the body of a multiline #define. | ||
| # 'body' refers to all the lines of a multiline #define except the first line. | ||
| # Requires 'pp_ignore_define_body = false'. | ||
| # | ||
| # <0: Absolute column: the body indentation starts off at the specified column | ||
| # (ex. -3 ==> the body is indented starting from column 3) | ||
| # >=0: Relative to the column of the '#' of '#define' | ||
| # (ex. 3 ==> the body is indented starting 3 columns at the right of '#') | ||
| # | ||
| # Default: 8 | ||
| pp_multiline_define_body_indent = 4 # number | ||
|
|
||
| # The value might be used twice: | ||
| # - at the assignment | ||
| # - at the opening brace | ||
| # | ||
| # To prevent the double use of the indentation value, use this option with the | ||
| # value 'true'. | ||
| # | ||
| # true: indentation will be used only once | ||
| # false: indentation will be used every time (default) | ||
| indent_cpp_lambda_only_once = true # true/false |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
| # | ||
| # uncrustify-0.72 is used to format simplecpp and cppcheck source code. | ||
| # | ||
| # 1. Download source code: https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.zip | ||
| # It's important that all developers use the exact same version so we don't get a "format battle". | ||
| # 2. Building: | ||
| # - Linux: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. && make | ||
| # - Windows: mkdir build && cd build && cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release .. && nmake | ||
| # 3. Ensure that the binary "uncrustify" is found by runformat. Either: | ||
| # - you can put uncrustify in your PATH | ||
| # - you can create an environment variable UNCRUSTIFY that has the full path of the binary | ||
|
|
||
| UNCRUSTIFY_VERSION="0.72.0" | ||
| UNCRUSTIFY="${UNCRUSTIFY-uncrustify}" | ||
|
|
||
| DETECTED_VERSION=$("$UNCRUSTIFY" --version 2>&1 | grep -o -E '[0-9.]+') | ||
| if [ "$DETECTED_VERSION" != "${UNCRUSTIFY_VERSION}" ]; then | ||
| echo "You should use version: ${UNCRUSTIFY_VERSION}" | ||
| echo "Detected version: ${DETECTED_VERSION}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # OS variables | ||
| [ $(uname -s) = "Darwin" ] && export OSX=1 && export UNIX=1 | ||
| [ $(uname -s) = "Linux" ] && export LINUX=1 && export UNIX=1 | ||
| uname -s | grep -q "_NT-" && export WINDOWS=1 | ||
|
|
||
| if [ $OSX ] | ||
| then | ||
| export CPUCOUNT=$(sysctl -n hw.ncpu) | ||
| elif [ $LINUX ] | ||
| then | ||
| export CPUCOUNT=$(nproc) | ||
| else | ||
| export CPUCOUNT="1" | ||
| fi | ||
|
|
||
| $UNCRUSTIFY -c .uncrustify.cfg --no-backup *.cpp *.h | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is likely incorrect and inconsistent, inspecting danmar/cppcheck@3726ace seems to indicate that the version should be
0.80.1There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I copied the file directly from cppcheck main though. :-( maybe we need to update the script both in cppcheck and simplecpp..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would you have time to look at that maybe?