-
Nearly every programming language has a static analyzer of its own. For example, golang has gofmt, which is baked into the standard tooling, while Ruby has Rubocop, a community-led project. Even compiled languages like C have their own static analyzer through astyle. However, it can be difficult (and tedious) to run several analyzers across polyglot projects. Fortunately, that’s where a project like PMD can be of assistance. PMD is a static analyzer that allows you to define a standard set of rules that can be applied over multiple languages.
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
Finally, clone our sample Apex project at this Git repository: https://github.com/gjtorikian/sfdc-linting.git
-
dreamhouse-lwc
Sample application for Lightning Web Components on Salesforce Platform. Part of the sample gallery. Real estate use case. Get inspired and learn best practices.
This repository is a forked copy of the dreamhouse-lwc project, except it has (intentionally) introduced some errors. We’ll use this to demonstrate how PMD works.
-
Before getting started, you should have some familiarity with Apex, Salesforce’s programming language which unlocks new possibilities for your organization. We’ll be using VS Code along with the Apex plugin. You’ll also need the Salesforce CLI, which is a tool designed by Salesforce to simplify interacting with the platform.
-
If you’re using GitHub Actions, you can just integrate an action such as this one, which takes care of all the installation and configuration for you. If you’re not, you simply need to run PMD as you do on the CLI, within a script:
Related posts
-
How to configure SonarLint to connect to SonarQube for VS Code
-
Navigating the Software Developer Life: Soft Skills, AI Tools, and Team Dynamics
-
PMD 7 Is Here
-
Amazon CodeGuru Reviewer: already time for retirement?
-
Advanced Contextual Preamble (ACP): A Novel Prompt Engineering Technique for Enhancing Corporate AI Model Interactions and Streamlining User Experiences