Skip to content

Commit

Permalink
Problem matchers (#7)
Browse files Browse the repository at this point in the history
* Problem matchers for inline feedback
  • Loading branch information
softprops authored and ScottBrenner committed Dec 25, 2019
1 parent e8dbcf8 commit 4e7c712
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# ignore all files by default
*
# include required files with an exception
!cfn-lint.json
!entrypoint.sh
!LICENSE
!README.md
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ LABEL "maintainer"="Scott Brenner <[email protected]>"
RUN apk --no-cache add python3
RUN pip3 install cfn-lint

COPY cfn-lint.json /cfn-lint.json
COPY entrypoint.sh /entrypoint.sh
RUN ["chmod", "+x", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This Action for [CloudFormation Linter](https://github.com/aws-cloudformation/cfn-python-lint/) enables arbitrary actions for interacting with CloudFormation Linter to validate CloudFormation yaml/json templates against the CloudFormation spec and additional checks. Includes checking valid values for resource properties and best practices.

![screenshot](screenshot.png)

## Usage

An example workflow for testing CloudFormation templates for correct properties and their values - run the `cfn-lint` command with the path to the files you want to test as `args`.
Expand Down
20 changes: 20 additions & 0 deletions cfn-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"problemMatcher": [
{
"owner": "cfn-lint",
"pattern": [
{
"regexp": "^([EWI](\\d{4}))\\s(.+)$",
"code": 1,
"message": 3
},
{
"regexp": "^(\\S+):(\\d+):(\\d+)$",
"file": 1,
"line": 2,
"column": 3
}
]
}
]
}
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

set -e

# Copy the matcher to the host system; otherwise "add-matcher" can't find it.
cp /cfn-lint.json /github/workflow/cfn-lint.json
echo "::add-matcher::${RUNNER_TEMP}/_github_workflow/cfn-lint.json"

sh -c "cfn-lint $*"
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4e7c712

Please sign in to comment.