Skip to content

Commit

Permalink
Initial PMD support
Browse files Browse the repository at this point in the history
  • Loading branch information
jwgmeligmeyling committed Jun 14, 2020
1 parent 9017599 commit 982e408
Show file tree
Hide file tree
Showing 14 changed files with 4,197 additions and 15,163 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
- uses: actions/checkout@v2
- uses: ./
with:
path: '**/spotbugsXml.xml'
path: '**/pmd.xml'
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
![build-test](https://github.com/jwgmeligmeyling/spotbugs-github-action/workflows/build-test/badge.svg)
![build-test](https://github.com/jwgmeligmeyling/pmd-github-action/workflows/build-test/badge.svg)

# SpotBugs GitHub Action
# PMD GitHub Action

This action pushes results from [SpotBugs](https://spotbugs.github.io/) (or [FindBugs](http://findbugs.sourceforge.net/)) as check run annotations. :rocket:
This action pushes results from [PMD](https://pmd.github.io/) as check run annotations. :rocket:

The action can also be used for any other static analysis tools that produce reports in the SpotBugs XML format.
The action can also be used for any other static analysis tools that produce reports in the PMD XML format.
The report itself must be generated in a former build step, for example a Maven build.

![example](images/example.png)
Expand All @@ -13,13 +13,13 @@ The report itself must be generated in a former build step, for example a Maven

### `path`
Required. A file, directory or wildcard pattern that describes where to find the reports.
Multiple files can be processed through a [glob expression](https://github.com/actions/toolkit/tree/master/packages/glob), for example: `'**/spotbugsXml.xml'`.
Multiple files can be processed through a [glob expression](https://github.com/actions/toolkit/tree/master/packages/glob), for example: `'**/pmd.xml'`.

### `name`
Optional. Name for the check run to create. Defaults to `spotbugs`.
Optional. Name for the check run to create. Defaults to `PMD`.

### `title`
Optional. Title for the check run to create. Defaults to `SpotBugs Source Code Analyzer report`.
Optional. Title for the check run to create. Defaults to `PMD Source Code Analyzer report`.

### `token`
Optional. GitHub API access token. Defaults to `${{ github.token }}`, which is set by `actions/checkout@v2` minimally.
Expand Down Expand Up @@ -47,10 +47,10 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- name: Build with Maven
run: mvn -B verify spotbugs:spotbugs
- uses: jwgmeligmeyling/spotbugs-github-action@v1
run: mvn -B verify pmd:pmd
- uses: jwgmeligmeyling/pmd-github-action@v1
with:
path: '**/spotbugsXml.xml'
path: '**/pmd.xml'
```
And do not forget to enable XML output for the Maven plugin:
Expand All @@ -59,12 +59,13 @@ And do not forget to enable XML output for the Maven plugin:
<build>
<plugins>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.0.0</version>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<xmlOutput>true</xmlOutput>
<failOnError>false</failOnError>
<includeTests>true</includeTests>
<failOnViolation>false</failOnViolation>
<skipEmptyReport>false</skipEmptyReport>
</configuration>
</plugin>
</plugins>
Expand Down
9 changes: 2 additions & 7 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,7 @@ beforeAll(() => {
})

test('parses file', async () => {
const spotBugsXml = path.resolve(
__dirname,
'..',
'reports',
'spotbugsXml.xml'
)
const spotBugsXml = path.resolve(__dirname, '..', 'reports', 'pmd.xml')
const annotations = annotationsForPath(spotBugsXml)
expect(annotations).toHaveLength(12)
expect(annotations).toHaveLength(171)
})
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'Push SpotBugs report'
description: 'Push SpotBugs Code Analysis report'
name: 'Push PMD report'
description: 'Push PMD Code Analysis report'
author: 'Jan-Willem Gmelig Meyling'
inputs:
path:
description: 'A file, directory or wildcard pattern that describes where to find the reports'
required: true
name:
description: 'Check run name under which the report is created'
default: spotbugs
default: PMD
title:
description: 'Check run title under which the report is created'
default: SpotBugs Source Code Analyzer report
default: PMD Source Code Analyzer report
token:
description: >
Personal access token (PAT) used to fetch the repository. The PAT is configured
Expand Down
Loading

0 comments on commit 982e408

Please sign in to comment.