Skip to content

Commit

Permalink
Merge pull request #1 from avency/master
Browse files Browse the repository at this point in the history
feat: Add exclude option
  • Loading branch information
mikebronner authored Sep 23, 2022
2 parents c6cd04e + 545e7f3 commit 97fa17b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ or a custom rules configuration file path.
reporter: 'github-pr-check'
standard: 'cleancode,codesize,controversial,design,naming,unusedcode'
target_directory: 'src'
exclude: '*/Migrations/*'
name: 'PHPMD'
```
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ inputs:
description: Directory to run checks against.
default: 'src'

exclude:
description: List of exclude patterns
default: ''

name:
description: The name of the check
default: 'PHPMD'

baseline_file:
description: A baseline file
default: ''

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -31,6 +43,9 @@ runs:
- ${{ inputs.reporter }}
- ${{ inputs.standard }}
- ${{ inputs.target_directory }}
- ${{ inputs.exclude }}
- ${{ inputs.name }}
- ${{ inputs.baseline_file }}

branding:
icon: 'check-circle'
Expand Down
14 changes: 12 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ fi

export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"

php /usr/local/bin/phpmd.phar ${INPUT_TARGET_DIRECTORY} text ${INPUT_STANDARD} \
excludeOption=""
if [ "$INPUT_EXCLUDE" != "" ]; then
excludeOption=" --exclude $INPUT_EXCLUDE"
fi;

baselineFileOption=""
if [ "$INPUT_BASELINE_FILE" != "" ]; then
baselineFileOption=" --baseline-file $INPUT_BASELINE_FILE"
fi;

php /usr/local/bin/phpmd.phar ${INPUT_TARGET_DIRECTORY}${excludeOption}${baselineFileOption} text ${INPUT_STANDARD} \
| sed -r "s/([0-9]+)\s+/\1:/gI" \
| reviewdog -name=PHPMD -f=phpstan -reporter=${INPUT_REPORTER} -level=${INPUT_LEVEL} -diff='git diff'
| reviewdog -name="${INPUT_NAME}" -f=phpstan -reporter=${INPUT_REPORTER} -level=${INPUT_LEVEL} -diff='git diff'

0 comments on commit 97fa17b

Please sign in to comment.