You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

Basic C Code lint checker and shell checker (#859) * Factor build packages out into a more maintainable list * Create a location for scripts to live * Provide a make target to return the source dir as close as reasonable to the original distributed state * Add a code lint step, checking the coding style * Change test harness as recommended by shellcheck * Ensure we actually have the linter tool installed * Use the correct directory for cmake to run the tests * Adjust for the older uncrustify in the current github ubuntu-latest * Make one file pass the linter * Integrate the lint with the existing test workflow * Add files with minimal changes needed to the linter * Add more files with minimal changes needed to the linter * Dont build binaries if we fail the lint test * Update the phony targets with the lint steps * Ensure the flake8 package is installed in the new lint workflow job * Use the makefile to drive the packages needed to install for linting * No need to add dependancies on lint, just rely on the workflow status to show failure * Update the scripts dir README to reflect current assumptions * Rename and briefly document the indent.sh script * Fix the ignore to ignore the right Makefile * Rename the test_harness script to make it clear it is a shell script * Provide a master lint make target and add a shell script lint tool * Elminate stray tabs * Drop include/auth.h from linter - there are inconsistant results with function definitions when using the current uncrustify rules
3 years ago
# Initial rules taken from a quick discussion
# (See https://github.com/ntop/n2n/commit/00159d0d012c6836fd972af1748833eeaf50fa22#commitcomment-57137247)
# 4 space indention (never use tabs)
indent_columns = 4
indent_with_tabs = 0
indent_switch_case = 4
# space between name and bracket during function define
sp_func_def_paren = force
sp_func_proto_paren = force
# no space between name and bracket during call
sp_func_call_paren = remove
# no space after if and while
sp_before_sparen = remove
#sp_while_paren_open = remove # only in newer uncrustify
# block-braces as seen above
nl_if_brace = remove
nl_brace_else = remove
nl_elseif_brace = remove
nl_else_brace = remove
#nl_before_opening_brace_func_class_def = remove # only in newer uncrustify
nl_for_brace = remove
nl_while_brace = remove
# multi-line parameters with indentation under the opening bracket
# looks like this is the default, but might be the following:
#indent_func_call_param = false ?
# Want to keep var definition alignment
#align_keep_extra_space = true