benjaminloerincz / vscode-apex-pmd

PMD static analysis for Apex in vscode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apex-pmd

Allows you to run Apex Static Analysis directly in vscode.

Features

Apex PMD

Current actions Supported

  • Run analysis on file open
  • Run analysis on file save
  • Run analysis on entire workspace
  • Run analysis on single file
  • Ability to define your own ruleset

Installation

  1. Must have JDK >=1.4 installed and in path
  2. Download a PMD "bin" release (>= 5.6)
  3. unzip to location of choice
  4. In VScode, Open Preferences: User Settings and set apexPMD.pmdPath to folder where pmd was unzipped in step 3

Configuration

    // absolute path to where PMD was installed
    "apexPMD.pmdPath": "/Users/johndoe/pmd",

    // Set to false to use you own ruleset (set path)
    "apexPMD.useDefaultRuleset": "true",

    // Absolute path to ruleset xml file.  Must also set `useDefaultRuleset:false`.
    "apexPMD.rulesetPath": "",

    // Will run static analysis every time a file is opened
    "apexPMD.runOnFileOpen": "true",

    // Will run static analysis every time a file is saved
    "apexPMD.runOnFileSave": "true",

    // Determines at what priority level 'errors' will be added. Anything less will be a warning or hint
    "apexPMD.priorityErrorThreshold": "1",

    // Determines at what priority level 'warnings' will be added. Anything less will be a hint
    "apexPMD.priorityWarnThreshold": "3"

Defining your own "Ruleset"

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

Set "apexPMD.useDefaultRuleset": "false" and update apexPMD.rulesetPath to reference your custom ruleset.

Apex Ruleset Reference

About

PMD static analysis for Apex in vscode

License:MIT License


Languages

Language:TypeScript 100.0%