6 Commits
0.3.0 ... 0.5.0

Author SHA1 Message Date
Joakim Sørensen
c489c81f79 Re enable problem-matcher (#25) 2020-07-28 14:21:49 +02:00
pvogt09
73cbb64041 Fixes issues with globbing files with partial match(#23)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2020-07-28 13:54:55 +02:00
Tom Riat
c7d4e499f1 Update action checkout to the new default branch (#24)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2020-07-28 10:59:37 +02:00
Oscar Tin Lai
7ee62c0418 Enable shellcheck for shebang with /bin/env (#22)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2020-07-14 20:39:58 +02:00
Joakim Sørensen
2394c9008b Remove problem matcher
Fixes #21
2020-07-14 20:29:42 +02:00
Joakim Sørensen
637bb438ec Adds problem-matcher (#20)
* Adds problem-matcher

* Fix issue

* match as group 1

* use message

* Limit output

* remove testfile
2020-07-05 23:50:07 +02:00
7 changed files with 66 additions and 21 deletions

22
.github/problem-matcher.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"problemMatcher": [
{
"owner": "shellcheck",
"pattern": [
{
"regexp": "^In\\s(.+)\\sline\\s(\\d+):$",
"file": 1,
"line": 2
},
{
"regexp": ".*"
},
{
"regexp": "(SC\\d+):\\s(.+)$",
"code": 1,
"message": 2
}
]
}
]
}

View File

@@ -5,8 +5,10 @@ jobs:
name: ShellCheck
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v2
- name: Run ShellCheck
uses: ./
with:

View File

@@ -3,4 +3,6 @@ FROM alpine:3.12.0
RUN apk add --no-cache shellcheck bash
COPY runaction /action/runaction
COPY .github/problem-matcher.json /problem-matcher.json
ENTRYPOINT ["bash", "/action/runaction"]

View File

@@ -17,7 +17,7 @@ jobs:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
```

View File

@@ -1,5 +1,11 @@
#!/bin/bash
## Enable problem matcher
cp /problem-matcher.json ./problem-matcher.json
echo "::add-matcher::problem-matcher.json"
## Run action
cd "$GITHUB_WORKSPACE" || exit 1
declare statuscode
@@ -8,6 +14,7 @@ declare -a excludes
declare -a tmp
statuscode=0
shebangregex="^#! */[^ ]*/(env *)?[abkz]*sh"
excludes+=( ! -path *./.git/* )
excludes+=( ! -path *.go )
@@ -23,34 +30,38 @@ readarray -d '' filepaths < <(find . -type f "${excludes[@]}" \
'(' \
\
-name '*.bash' \
-o -path '*/.bash*' \
-o -path '*/bash*' \
-o -name '.bashrc' \
-o -name 'bashrc' \
-o -name '.bash_aliases' \
-o -name '.bash_completion' \
-o -name '.bash_login' \
-o -name '.bash_logout' \
-o -name '.bash_profile' \
-o -name 'bash_profile' \
-o -name '*.ksh' \
-o -name 'ksh*' \
-o -path '*/.ksh*' \
-o -path '*/ksh*' \
-o -name 'suid_profile' \
-o -name '*.zsh' \
-o -name '.zlogin*' \
-o -name 'zlogin*' \
-o -name '.zlogout*' \
-o -name 'zlogout*' \
-o -name '.zprofile*' \
-o -name 'zprofile*' \
-o -path '*/.zsh*' \
-o -path '*/zsh*' \
-o -name '.zlogin' \
-o -name 'zlogin' \
-o -name '.zlogout' \
-o -name 'zlogout' \
-o -name '.zprofile' \
-o -name 'zprofile' \
-o -name '.zsenv' \
-o -name 'zsenv' \
-o -name '.zshrc' \
-o -name 'zshrc' \
-o -name '*.sh' \
-o -path '*/.profile*' \
-o -path '*/.shlib*' \
-o -path '*/shlib*' \
-o -path '*/.profile' \
-o -path '*/profile' \
-o -name '*.shlib' \
')'\
\
-print0)
readarray -d '' tmp < <(find . "${excludes[@]}" -type f ! -name '*.*' -perm /111 -print0)
for file in "${tmp[@]}"; do
head -n1 "$file" | grep -Eqs "^#! */[^ ]*/[abkz]*sh" || continue
head -n1 "$file" | grep -Eqs "$shebangregex" || continue
filepaths+=("$file")
done

6
testfiles/bashfile.c Normal file
View File

@@ -0,0 +1,6 @@
/* C code test file
* file that should not be matched for shellcheck runs
*/
int main(void) {
return 0;
}

View File

@@ -1,3 +1,5 @@
#!/bin/sh
echo $test
echo $test $test
echo $test2