Coder Social home page Coder Social logo

setup-pmd's Introduction

PMD Source Code Analyzer Action

This action allows to use PMD Source Code Analyzer from GitHub Actions

Example usage

name: PMD Source Code Analyzer on Push

on: [push]

jobs:
  pmd:
  
    runs-on: ubuntu-latest
    
    steps:
      - uses: sfdx-actions/setup-pmd@v1
      - name: run-pmd
        run: pmd -d ./force-app/main/default/classes -R category/apex/design.xml -f text

License

MIT License

Copyright (c) 2019 Felipe Echanique Torres (felipe.echanique at gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

setup-pmd's People

Contributors

fechanique avatar oltrep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

setup-pmd's Issues

PMD instalation error

Hi,

when i run an action with github next error displays:

image

Also there will be a great idea add a parameter to tell which version of pmd use.

thanks in advance.

pmd command not found.

Hey trying to use this Github Action but I am running to one issue. I am using sfdx-actions/pmd@v9, but when I was using sfdx-actions/pmd@v1 it was giving me output under the
uses: sfdx-actions@v1 when I switched to v9 I am getting pmd command not found. When I use v1 it errors out on the uses section.

actions file


    steps:
      - uses: sfdx-actions/pmd@v9
      - name: run-pmd
        run: pmd -d ./force-app/main/default/classes -R category/apex/design.xml -f text

Output

Set up job 2s
Run actions/checkout@v1 1s
Run sfdx-actions/pmd@v9 2s
Run sfdx-actions/pmd@v9
Run sfdx-actions/pmd@v9
run-pmd0s
##[error]Process completed with exit code 127.
Run pmd -d ./force-app/main/default/classes -R category/apex/design.xml -f text
/home/runner/work/_temp/483de406-35ea-4920-831d-0b2aefec05e7.sh: line 1: pmd: command not found
##[error]Process completed with exit code 127.
Complete job

How to pass custom ruleset xml containing rule ref

If I try to pass the default QuickStart.xml file

It always gives error in OperationWithLimitsInLoop.

Unable to find referenced rule OperationWithLimitsInLoop; perhaps the rule name is mispelled?
Mandatory arguments:

  1. A java source code filename or directory
  2. A report format
  3. A ruleset filename or a comma-delimited string of ruleset filenames

For example:
C:>pmd-bin-6.19.0\bin\pmd.bat -d c:\my\source\code -f html -R java-unusedcode

When comparing I found, the ruleset.xml which this internally refers is <rule name="ExcessiveParameterList" .

How can I pass custom ruleset xml for PMD to reference it?

Some PMD parameters not working

I'm not completely sure if this is an issue or if I am doing something wrong here.

I'm using this code:

# Setup pmd
- name: 'Setup PMD'
    uses: sfdx-actions/setup-pmd@v1

# Checkout the code
- name: 'Checkout source code'
    uses: actions/checkout@v2

# Run PMD Analysis
- name: 'Run PMD'
    run: |
        pmd -d ./force-app/main/default/ -R ./config/pmd-ruleset.xml -failOnViolation false -f html -shortnames -P linkPrefix="/some/path/" -P linePrefix="L" -reportfile ./ReportPMD.html

# Upload PMD report as an artifact
- name: 'Upload PMD report'
    uses: actions/upload-artifact@v3
    with:
    name: PMD-Apex-Report
    path: ./ReportPMD.html

It works just fine, I got the report in the GitHub action artifacts section.

But the HTML report is not considering the -shortnames -P linkPrefix="/some/path/" -P linePrefix="L" parameters.

The report looks like this:
image

The report shows an entire path for the File Column ignoring the -shortnames parameter.
The File Colmun also should be a link to "/some/path/", specified in -P linkPrefix="/some/path/"
The Line Number should be an L#, specified in -P linePrefix="L"

Am I missing something?

Thanks!

PD, Is it possible to update or define the PMD version used? How Can I do that?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.