Our great sponsors
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
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.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
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.
Finally, clone our sample Apex project at this Git repository: https://github.com/gjtorikian/sfdc-linting.git
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
- 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
- Check out pynalyzer - easy to use meta static code analysis bundle