Set your own coding standards with customizable static code analysis settings

Set your own coding standards with customizable static code analysis settings

Ellis Toms on

Share with

LinkedIn
Twitter

Gearset’s static code analysis already helps you write high quality, easily maintainable Apex code. Now, with customisable static code analysis rule sets, you can easily keep on top of what matters, helping you catch any bugs early and ensure that your team is consistently writing effective, safe Apex.

Team owners can now turn static code analysis rules on and off, customize individual rules and choose to exclude specific packages and classes. With Gearset’s configurable static code analysis rules and customisable settings, it’s easier than ever to manage your code standards and ensure that you are consistently developing high quality code.

Live eventConvene, Chicago

DevOps Dreamin' Chicago 2024

Find out more

Customize your static code analysis rule set and configure individual rule settings

Your Gearset team owner will be able to configure your static code analysis rules from the Static code analysis rule sets page within the app.

Navigate to the Static code analysis rule sets page

Rules are organized by type, such as “Complexity” and “Performance”. A short description of the rule lets you understand what that specific rule will analyze for within your code, allowing you to fine tune the code analysis to match your development process. To enable or disable specific rules entirely, simply click on the toggle to turn the rule on and off.

Enable or disable individual static code analysis rules

The team owner can also configure individual rule settings by clicking the cog icon next to each rule. For example, for complexity rule ExcessiveClassLength you can specify the maximum length of class that can be allowed. Here the maximum class length is set to 999 lines.

Edit individual rules to suit the needs of your team

You can also export rule sets and use them to run static code analysis locally.

Manage which packages and classes to exclude from your code analysis

Within Gearset, team owners can also exclude specific packages and classes. Once you exclude a package or class, it’ll be entirely ignored by the code analysis results and won’t trigger any rule violations.

To select which packages and classes you’d like to exclude, first navigate to the same Code analysis settings page. Under Exclude packages and classes, click the cog icon.

Click on the cog to manage which classes and packages to exclude

Next, type in the package or class name you wish to exclude and click Add to list. Any packages or classes you choose to exclude will then be visible on the Code analysis settings page.

Select which classes and packages you'd like to exclude

Clearer static code analysis results for your change monitoring jobs

Static code analysis results are currently generated every time a change monitoring job runs (if you need help setting up a change monitoring job take a look at our quick start guide). Gearset’s updated UI for the static code analysis results of your change monitoring jobs makes it even faster to locate, understand and fix any problems within your code.

To find your static code analysis results, firstly navigate to the Monitoring and Backup page and click View history to see the results of your change monitoring job. Click View code analysis… for any of the job runs to see the full rundown of the changing state of your Apex code.

View your code analysis for each change monitor job run

When you view your code analysis results for each job run, you’ll be able to filter the results categorically by type of static code analysis rule by clicking on the type of issue.

See all of your static code results
Or filter your results by code analysis type

For any violation detected, Gearset will tell you which line of code the issue begins on and provide a description so you can easily understand why issues have been flagged in your Apex. For more detailed information on each specific rule, just click on the name of the rule and you’ll be taken to the PMD library for a more in-depth look at the individual rule and its Java implementation.

Why not try it for yourself?

Customizable static code analysis settings not only ensure that your coding standards fit the development process of your team, but adjustable settings mean that your code standards can constantly evolve alongside your release process. If this sounds like something you’d love to try out, start your 30-day free trial with Gearset today.

Try all of Gearset for free