Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathroule/danger-pmd
Danger plugin for PMD
https://github.com/mathroule/danger-pmd
danger danger-plugin pmd
Last synced: 16 days ago
JSON representation
Danger plugin for PMD
- Host: GitHub
- URL: https://github.com/mathroule/danger-pmd
- Owner: mathroule
- License: mit
- Created: 2019-10-03T22:09:43.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-22T20:38:38.000Z (3 months ago)
- Last Synced: 2024-10-08T23:10:50.693Z (about 1 month ago)
- Topics: danger, danger-plugin, pmd
- Language: Ruby
- Homepage:
- Size: 123 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-danger - danger-pmd - Danger plugin for PMD formatted XML file. (Plugins / Ruby (danger))
README
# Danger PMD
[![Latest release](https://img.shields.io/github/v/release/mathroule/danger-pmd.svg)](https://github.com/mathroule/danger-pmd/releases/latest) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Deploy](https://github.com/mathroule/danger-pmd/workflows/Deploy/badge.svg)](https://github.com/mathroule/danger-pmd/actions) [![codecov](https://codecov.io/gh/mathroule/danger-pmd/branch/main/graph/badge.svg?token=HYA9XW0GL5)](https://codecov.io/gh/mathroule/danger-pmd)Checks on your Gradle project's Java source files.
This is done using [PMD](https://pmd.github.io)
Results are passed out as tables in markdown.This plugin is inspired from https://github.com/kazy1991/danger-findbugs.
## Installation
$ gem install danger-pmd
## Usage
Methods and attributes from this plugin are available in
your `Dangerfile` under the `pmd` namespace.Running PMD with its basic configuration
pmd.report
Running PMD with a specific Gradle task or report file (glob accepted)
pmd.gradle_task = 'module:pmd' # default: 'pmd'
pmd.report_file = 'module/build/reports/pmd/pmd.xml' # default: 'app/build/reports/pmd/pmd.xml'
pmd.report
Running PMD with a specific root path
pmd.root_path = '/Users/developer/project' # default: result of `git rev-parse --show-toplevel`
pmd.report
Running PMD with an array of report files (glob accepted)
pmd.report_files = ['modules/**/build/reports/pmd/pmd.xml', 'app/build/reports/pmd/pmd.xml']
pmd.report
Running PMD without running a Gradle task
pmd.skip_gradle_task = true # default: false
pmd.report
Running PMD without inline comment
pmd.report(inline_mode: false) # default: true
#### Attributes
`gradle_task` - Custom Gradle task to run.
This is useful when your project has different flavors.
Defaults to "pmd".`skip_gradle_task` - Skip Gradle task.
If you skip Gradle task, for example project does not manage Gradle.
Defaults to `false`.`root_path` - An absolute path to a root.
To comment errors to VCS, this needs to know relative path of files from the root.
Defaults to result of "git rev-parse --show-toplevel".`report_file` - Location of report file.
If your pmd task outputs to a different location, you can specify it here.
Defaults to "app/build/reports/pmd/pmd.xml".`report_files` - Location of report files.
If your pmd task outputs to a different location, you can specify it here.
Defaults to ['app/build/reports/pmd/pmd.xml'].#### Methods
`report` - Calls PMD task of your Gradle project.
It fails if `gradlew` cannot be found inside current directory.
It fails if `report_file` cannot be found inside current directory.
It fails if `report_files` is empty.`gradle_task` - A getter for `gradle_task`, returning Gradle task report.
`skip_gradle_task` - A getter for `skip_gradle_task`.
`root_path` - A getter for `root_path`.
`report_file` - A getter for `report_file`.
`report_files` - A getter for `report_files`.
## Development
1. Clone this repo
2. Run `bundle install` to setup dependencies.
3. Run `bundle exec rake spec` to run the tests.
4. Use `bundle exec guard` to automatically have tests run as you make changes.
5. Make your changes.