Set your own coding standards with customizable static code analysis settings
Ellis Toms on February 7th 2018
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.
Enterprise-tier team owners can now turn static code analysis rules on and off, customise 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.
Customise 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.
Rules are displayed categorically by type, such as “Complexity” and “Performance” rules. 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.
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.
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.
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.
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.
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.
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?
Customisable 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 free 30-day trial with Gearset today.
Configurable static code analysis settings are part of the Gearset Enterprise subscription, so if you are on Pro and would like to try it out, contact us via the live in-app chat or at [email protected] for a free trial of our Enterprise tier.