GithubHelp home page GithubHelp logo

jefersonchaves / vscode-apex-pmd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chuckjonas/vscode-apex-pmd

0.0 1.0 0.0 145.18 MB

PMD static analysis for Apex in vscode

License: MIT License

Shell 19.88% JavaScript 3.86% Apex 0.50% TypeScript 68.86% Batchfile 6.90%

vscode-apex-pmd's Introduction

vscode Apex Pmd

Visual Studio Marketplace Version Visual Studio Marketplace Installs - Azure DevOps Extension Build Status

Allows you to run Apex Static Analysis directly in vscode on Apex, VisualForce & other XML metadata files.

Features

Apex PMD

Current actions Supported

  • Run analysis on file open
  • Run analysis on file save
  • Run analysis on file change (new!)
  • Run analysis on entire workspace
  • Run analysis on single file
  • Ability to define your own ruleset

System Requirements

Configuration

  • rulesets (optional): set to override default ruleset (see "Defining your own ruleset" for more details)
  • runOnFileOpen: run every time a file is opened in vscode
  • runOnFileSave: run every time a file is saved
  • runOnFileChange: Run when a file is changed. NOTE: this is "debounced" to prevent performance issues. Delay can be adjusted via onFileChangeDebounce.
  • priorityErrorThreshold: Determines at what priority level 'errors' will be added. Anything less will be a warning or hint
  • priorityWarnThreshold: Determines at what priority level 'warnings' will be added. Anything less will be a hint
  • enableCache: Creates a cache file for PMD to run faster. Will create a .pmdCache file in your workspace
  • pmdBinPath (prev. pmdPath) (optional): set to override the default pmd binaries. This should point to the PMD folder which contains folders lib and bin. Most likely it is called libexec.
  • additionalClassPaths (optional): set of paths to be appended to classpath. Used to find jar files containing custom rule definitions. Can be absolute or relative to workspace.
  • commandBufferSize Size of buffer used to collect PMD command output (MB), may need to be increased for very large projects
  • jrePath (Optional) Path to JRE (Folder that contains which contains bin/java)

Defining your own "Ruleset"

I recommend you use the default ruleset as a starting point.

Set apexPMD.rulesets string array to reference your custom rulesets. You can either use the absolute paths, or a relative paths from your workspace (EG my-apex-rules.xml).

You can also mention the default ruleset in apexPMD.rulesets. To do this add default value to the array.

Apex Ruleset Reference

NOTE: If you move away from the default ruleset in an sfdx project, make sure to exclude the .sfdx generated classes by keeping this line:

<exclude-pattern>.*/.sfdx/.*</exclude-pattern>

Using custom rules written in Java

If you want to use your own custom rules from a jar file, then the jar file must be on the classpath. By default, the PMD folder and the workspace root folder are included in the classpath. You can add further folders using the additionalClassPaths setting. This "Hello world" example is a good starting place for beginners.

Developing/Contributing

Setup & Run

  1. git clone
  2. npm install
  3. debug -> "launch extension"

Upgrading PMD

npm run update-pmd

Any pull request submitted with updates to PMD MUST BE "CHECKSUMED"!

Legal Stuff

Copyright (c) 2020 Charles Jonas and Contributors

PMD License

Contains Distribution of PMD library.

Copyright (c) 2003-2009, InfoEther, LLC
All rights reserved.

This product includes software developed in part by support from
the Defense Advanced Research Project Agency (DARPA)

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The full license (BSD-style) can be found in the PMD repo

vscode-apex-pmd's People

Contributors

chuckjonas avatar nchursin avatar nawforce avatar dangmai avatar dschach avatar ntotten avatar pawelwozniak avatar ricka avatar

Watchers

James Cloos avatar

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.