Skip to content

Commit

Permalink
feat: expose --except option (#4)
Browse files Browse the repository at this point in the history
* feat: expose --except option
  • Loading branch information
adthrasher authored Oct 23, 2024
1 parent d5f2160 commit 83ba654
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.81
FROM rust:1.82
WORKDIR /app

COPY . .
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This action uses [Sprocket](https://github.com/stjude-rust-labs/sprocket) to val
**Optional** If specified, Sprocket `check` will fail if any `warnings` are produced.
### `deny-notes`
**Optional** If specified, Sprocket `check` will fail if any `notes` are produced.
### `except`
**Optional** If specified and `lint`==`true`, then the listed rules will be excepted from all `sprocket lint` checks. Multiple rules can be specified as a comma-separated list, e.g. `CallInputSpacing,CommandSectionMixedIndentation`. Valid options can be found at: https://docs.rs/wdl/latest/wdl/lint/index.html#lint-rules.


## Example usage
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ inputs:
description: 'Fail the check if there are any notes.'
required: false
default: 'false'
except:
description: 'Comma separated list of rules to exclude from Sprocket check.'
required: false
default: ''
outputs:
status:
description: "The status of the check"
Expand Down
18 changes: 17 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#!/bin/bash

echo "===configuration==="
echo "lint: $INPUT_LINT"
echo "exceptions: $INPUT_EXCEPT"
echo "warnings: $INPUT_WARNINGS"
echo "notes: $INPUT_NOTES"
echo "patterns: $INPUT_PATTERNS"

lint=""
exceptions=""

if [ $INPUT_LINT = "true" ]; then
lint="--lint"
if [ -n "$INPUT_EXCEPT" ]; then
echo "Excepted rule(s) provided."
for exception in $(echo $INPUT_EXCEPT | sed 's/,/ /')
do
exceptions="$exceptions --except $exception"
done
fi
fi

warnings=""
Expand Down Expand Up @@ -43,7 +58,8 @@ do
fi
fi
echo " [***] $file [***]"
sprocket check $lint $warnings $notes $file || EXITCODE=$(($? || EXITCODE))
echo "sprocket check $lint $warnings $notes $exceptions $file"
sprocket check $lint $warnings $notes $exceptions $file || EXITCODE=$(($? || EXITCODE))
done

echo "status=$EXITCODE" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit 83ba654

Please sign in to comment.