6/26/2023 0 Comments Visual studio code analysis![]() ![]() When using PMD in VSCode, it’s key that your ruleset aligns with the rules used later in your workflow. Please note that Apex PMD is a marketplace extension for VSCode and not officially endorsed by Gearset or Salesforce, so make sure to clarify any security/installation concerns within your organization before getting started. ![]() One available extension is Apex PMD for VSCode which allows you to run PMD static code analysis within your local VSCode instances and find issues earlier on in the process at the developer level. With PMD being open source, various contributors can support its development and extend its capabilities. For more guidance on building the right ruleset, download our Static Code Analysis for Apex whitepaper, or take a look at the SCA course on our free training platform, DevOps Launchpad. The screenshot below shows how you can do this within Gearset. You and your team won’t necessarily want to use the entire PMD ruleset, so you can configure or disable rules to meet your needs. You can use PMD via other tools and platforms, including Gearset’s static code analysis functionality and Salesforce’s own Code Analyzer which draws on the PMD library along with some other source code analyzers. You can extend those rulesets as needed with your own custom rules. For Salesforce developers writing Apex, PMD has lots of default rules around different areas (best practice, security, performance etc). You can use PMD rulesets to highlight common mistakes/flaws in your source code, allowing quality gates to be applied at various stages. PMD is an open-source static code analyzer focused on specific languages, including Apex. For Apex analysis, we’d encourage you to use PMD. It can make up a big part of your overall testing strategy at the various stages, including unit, integration and regression testing, as you want to ensure consistent guidelines are followed and key areas (like security) are considered at all stages. While it’s different to testing that your code works as intended, testing for code quality with static code analysis is important.
0 Comments
Leave a Reply. |