Note
GitHub Marketplace may not show all the avaliable releases, check the repository for the newest release.
This action reads a Clover Coverage Report and creates one (and only one) comment on the Pull Request related to the run with a summary of the report.
It was highly inspired on the project: danhunsaker/clover-reporter-action, but with expanded configuration to better suit the needs on our projects.
Coverage report for commit: 9f99ed3
File: clover.example.base.xml
Summary - Lines: 87.97% 🔽 | Methods: 81.05% 🔼
| Files | Lines | Methods | Branches |
|---|---|---|---|
| src/main/php/PHPMD | |||
| AbstractNode.php | 86.05% | 70.59% | - |
| AbstractRenderer.php | 100.00% | 100.00% | - |
| AbstractRule.php | 80.00% | 72.00% | - |
| PHPMD.php | 90.32% | 75.00% | - |
| Parser.php | 89.19% | 92.86% | - |
| ParserFactory.php | 90.63% | 71.43% | - |
| ProcessingError.php | 100.00% | 100.00% | - |
| Report.php | 100.00% | 100.00% | - |
| RuleSet.php | 87.10% | 71.43% | - |
| RuleSetFactory.php | 96.32% | 86.36% | - |
| RuleViolation.php | 73.33% | 33.33% | - |
| src/main/php/PHPMD/Baseline | |||
| BaselineFileFinder.php | 100.00% | 100.00% | - |
| BaselineSet.php | 100.00% | 100.00% | - |
| BaselineSetFactory.php | 100.00% | 100.00% | - |
| BaselineValidator.php | 100.00% | 100.00% | - |
| ViolationBaseline.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Exception | |||
| RuleClassFileNotFoundException.php | 100.00% | 100.00% | - |
| RuleClassNotFoundException.php | 100.00% | 100.00% | - |
| RuleSetNotFoundException.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Node | |||
| ASTNode.php | 100.00% | 100.00% | - |
| AbstractCallableNode.php | 100.00% | 100.00% | - |
| AbstractNode.php | 100.00% | 100.00% | - |
| AbstractTypeNode.php | 100.00% | 100.00% | - |
| Annotation.php | 100.00% | 100.00% | - |
| Annotations.php | 100.00% | 100.00% | - |
| ClassNode.php | 100.00% | 100.00% | - |
| FunctionNode.php | 50.00% | 50.00% | - |
| InterfaceNode.php | 100.00% | 100.00% | - |
| MethodNode.php | 100.00% | 100.00% | - |
| TraitNode.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Renderer | |||
| BaselineRenderer.php | 100.00% | 100.00% | - |
| GitHubRenderer.php | 100.00% | 100.00% | - |
| HTMLRenderer.php | 85.71% | 63.64% | - |
| JSONRenderer.php | 100.00% | 100.00% | - |
| RendererFactory.php | 100.00% | 100.00% | - |
| SARIFRenderer.php | 98.36% | 80.00% | - |
| TextRenderer.php | 100.00% | 100.00% | - |
| XMLRenderer.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Rule | |||
| AbstractLocalVariable.php | 87.32% | 69.23% | - |
| CyclomaticComplexity.php | 100.00% | 100.00% | - |
| ExcessivePublicCount.php | 100.00% | 100.00% | - |
| UnusedFormalParameter.php | 100.00% | 100.00% | - |
| UnusedLocalVariable.php | 96.92% | 84.62% | - |
| UnusedPrivateField.php | 97.67% | 88.89% | - |
| UnusedPrivateMethod.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Rule/CleanCode | |||
| DuplicatedArrayKey.php | 84.38% | 50.00% | - |
| ElseExpression.php | 90.00% | 66.67% | - |
| ErrorControlOperator.php | 100.00% | 100.00% | - |
| IfStatementAssignment.php | 95.00% | 80.00% | - |
| MissingImport.php | 93.75% | 66.67% | - |
| StaticAccess.php | 100.00% | 100.00% | - |
| UndefinedVariable.php | 88.00% | 64.29% | - |
| src/main/php/PHPMD/Rule/Controversial | |||
| CamelCaseMethodName.php | 100.00% | 100.00% | - |
| CamelCaseParameterName.php | 100.00% | 100.00% | - |
| CamelCasePropertyName.php | 100.00% | 100.00% | - |
| CamelCaseVariableName.php | 93.75% | 50.00% | - |
| src/main/php/PHPMD/Rule/Design | |||
| CountInLoopExpression.php | 93.33% | 80.00% | - |
| CouplingBetweenObjects.php | 100.00% | 100.00% | - |
| DepthOfInheritance.php | 92.86% | 0.00% | - |
| DevelopmentCodeFragment.php | 100.00% | 100.00% | - |
| EmptyCatchBlock.php | 100.00% | 100.00% | - |
| EvalExpression.php | 100.00% | 100.00% | - |
| ExitExpression.php | 100.00% | 100.00% | - |
| GotoStatement.php | 100.00% | 100.00% | - |
| LongClass.php | 100.00% | 100.00% | - |
| LongMethod.php | 100.00% | 100.00% | - |
| LongParameterList.php | 100.00% | 100.00% | - |
| NpathComplexity.php | 100.00% | 100.00% | - |
| NumberOfChildren.php | 100.00% | 100.00% | - |
| TooManyFields.php | 100.00% | 100.00% | - |
| TooManyMethods.php | 100.00% | 100.00% | - |
| TooManyPublicMethods.php | 100.00% | 100.00% | - |
| WeightedMethodCount.php | 100.00% | 100.00% | - |
| src/main/php/PHPMD/Rule/Naming | |||
| BooleanGetMethodName.php | 100.00% | 100.00% | - |
| ConstantNamingConventions.php | 100.00% | 100.00% | - |
| ConstructorWithNameAsEnclosingClass.php | 88.89% | 0.00% | - |
| LongClassName.php | 100.00% | 100.00% | - |
| LongVariable.php | 100.00% | 100.00% | - |
| ShortClassName.php | 100.00% | 100.00% | - |
| ShortMethodName.php | 100.00% | 100.00% | - |
| ShortVariable.php | 96.92% | 92.31% | - |
| src/main/php/PHPMD/TextUI | |||
| Command.php | 100.00% | 100.00% | - |
| CommandLineOptions.php | 71.43% | 77.42% | - |
| src/main/php/PHPMD/Utility | |||
| Paths.php | 100.00% | 100.00% | - |
| Strings.php | 100.00% | 100.00% | - |
| Input | Description |
|---|---|
file |
The location of the clover file. Required |
base-file |
The location of the clover file with a previous state of the coverage to compare |
dir-prefix |
Section of the file on clover report to remove Default: github.workspace Required |
dir-prefix-keep |
Section of the dir-prefix to keep when creating link to file.Example: if your php application is at "$REPO/backend", then you should set this to "backend" |
only-with-cover |
Should only list files with at least one line covered. |
only-with-coverable-lines |
Should only list files with at least one "coverable" line of code Example: interfaces or abstract classes with no implementation |
lang |
In which language to format the numbers Default: en-US |
chart-size |
How many characters to use on chart's bar Default: 23 |
with-chart |
Add a chart with the distribution of coverage on files Default: true |
max-line-coverage-decrease |
How much the line coverage percentage can decrease without failing |
max-method-coverage-decrease |
How much the method coverage percentage can decrease without failing |
min-line-coverage |
Minimum percentage acceptable for line coverage Default: 0 |
min-method-coverage |
Minimum percentage acceptable for method coverage Default 0 |
with-table |
Add a table with a list of files and its coverage Default: true |
with-branches |
Adds the column "Branches" with the branching coverage Default: true |
show-percentage-change-on-table |
Show in percentage how much the file coverage changed per file |
table-type-coverage |
Which of the coverage percentages to filter Default: "lines" |
table-below-coverage |
Show only files below or equal to this coverage percentage Default: 100 |
table-above-coverage |
Show only files above or equal to this coverage percentage Default: 0 |
table-coverage-change |
Show only files which their coverage changed equal or above this percentage Default: 0 |
signature |
Custom signature to be used at the bottom of the comment. If you need multiple comments per pull request each step needs to have a unique signature |
github-token |
Custom PAT to be used instead of the default action token, should have the repo scope |
name: Unit Tests with coverage
on:
pull_request:
jobs:
php-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Execute Unit Tests
run: phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml
- name: Coverage Report as Comment (Clover)
uses: lucassabreu/comment-coverage-clover@main
with:
file: coverage.xmlname: Unit Tests with coverage
on:
pull_request:
push:
branches:
- main
jobs:
php-tests:
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
coverage: none
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress
- name: Execute Unit Tests
run: phpdbg -qrr vendor/bin/phpunit --coverage-clover=tests/coverage.xml
- if: ${{ github.event_name == 'pull_request' }}
name: Download artifact
uses: dawidd6/action-download-artifact@v2.14.1
continue-on-error: true
with:
workflow: .github/workflows/coverage-report.yml # this file
branch: main
name: coverage-report
path: tests/base
- if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: coverage-report
path: tests/coverage.xml
- if: ${{ github.event_name == 'pull_request' }}
name: Coverage Report as Comment (Clover)
uses: lucassabreu/comment-coverage-clover@main
with:
file: coverage.xml
base-file: tests/base/coverage.xml