File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ inputs:
7676 description : |-
7777 Is used to read a compile command database.
7878 default : " "
79+ only-diff :
80+ description : |-
81+ Is used to check only modified and appended files.
82+ default : " "
7983outputs :
8084 warnings-count :
8185 description : ' Total warnings count'
@@ -148,6 +152,7 @@ runs:
148152 VISIT_IMPLICIT_CODE : ${{ inputs.visit-implicit-code }}
149153 CLAZY_CHECKS_AS_ERRORS : ${{ inputs.warnings_as_errors }}
150154 IGNORE_HEADERS : ${{ inputs.ignore-headers }}
155+ ONLY_DIFF : ${{ inputs.only-diff }}
151156 run : |
152157 PATH=~/.local/clazy/bin:$PATH "$GITHUB_ACTION_PATH/clazy.sh"
153158
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ set -x
23
34options=()
45extra_args=()
56extra_args_before=()
7+ files=()
68
79for pair in $EXTRA_ARG ; do
810 extra_args+=( " --extra-arg=$pair " )
3537
3638pattern=' ^(.*?):([0-9]+):([0-9]+): (.+): (.+) \[(.*)\]$'
3739
38- IFS=' ,' read -r -a extensions <<< " $EXTENSIONS"
39- for ext in " ${extensions[@]} " ; do
40- while IFS= read -r -d ' ' file; do
41- files+=($( realpath " $file " ) )
42- done < <( find . -name " *.$ext " -print0)
43- done
40+ if [[ -n " $ONLY_DIFF " ]]; then
41+ for file in $( git diff --name-only HEAD^1 HEAD) ; do
42+ file_extension=" ${file##* .} "
43+ if echo " $EXTENSIONS " | grep -q " $file_extension " ; then
44+ files+=(" $( realpath " $file " ) " )
45+ fi
46+ done
47+ else
48+ IFS=' ,' read -r -a extensions <<< " $EXTENSIONS"
49+ for ext in " ${extensions[@]} " ; do
50+ while IFS= read -r -d ' ' file; do
51+ files+=($( realpath " $file " ) )
52+ done < <( find . -name " *.$ext " -print0)
53+ done
54+
55+ fi
4456
4557output=$( clazy-standalone --checks=" $CHECKS " -p=" $DATABASE " \
4658 --header-filter=" $HEADER_FILTER " --ignore-dirs=" $IGNORE_DIRS " \
You can’t perform that action at this time.
0 commit comments