The public preview for Dynamics 365 Business Central 2023 release wave 1 (BC22) is available. Learn more: Link.
I will continue to test and share some new features that I hope will be helpful.
Boost productivity of Business Central developers by improving performance of compilation, code analyzing, and individual code analyzer rules.
Developers often experience reduced responsiveness and delayed results when using static code analysis tools (AL cops) to find diagnostic issues. This can be annoying and affect their productivity, as they cannot react faster on the issues detected in the code. With this release we’re planning to improve the performance of the compiler and code analyzer framework, as well as optimize inefficient code analyzer rules—all to boost developer productivity.
A code analyzer is a library that builds on the compiler’s functionality to offer enhanced analysis of the syntax and semantics of your code at build time.
Let’s see more details.
To enable the code analysis, follow the steps below to create a basic project in AL.
Open the Command Palette Ctrl+Shift+P and choose either User Settings or Workspace Settings.
Under Extensions, go to Al Language extension configuration. When you scroll down, you’ll find Code Analyzers section, choose Edit in settings.json.
Alternatively, just click the Open Settings (Json) icon in the upper right corner.
al.enableCodeAnalysis in the settings file to
al.codeanalyzers setting, use Ctrl+Space to pick from the available code analyzers.
Separate the list of code analyzers with commas.
The AL Language extension for Microsoft Dynamics 365 Business Central for Visual Studio Code contains four analyzers:
- CodeCop is an analyzer that enforces the official AL Coding Guidelines. For more information about the CodeCop rules, see CodeCop Analyzer Rules.
- PerTenantExtensionCop is an analyzer that enforces rules that must be respected by extensions meant to be installed for individual tenants. For more information about the PerTenantExtensionCop rules, see PerTenantExtensionCop Analyzer Rules.
- AppSourceCop is an analyzer that enforces rules that must be respected by extensions meant to be published to Microsoft AppSource. For more information about the AppSourceCop rules, see AppSourceCop Analyzer Rules.
- UICop is an analyzer that enforces rules that must be respected by extensions that are meant to customize the Web Client. For more information about the UserInterfaceCop rules, see UICop Analyzer Rules.
At this point, the selected analyzers will run on your project.
More details: The Code Analysis Tool
With this release, Microsoft added two new settings to improve the performance of the compiler and code analyzer framework.
Specifies whether the code analysis should be performed in the background and the scope of the analysis. The ‘false’ value is equivalent to ‘None’ and the ‘true’ value is equivalent to ‘File’ for backwards compatibility.
Specifies whether code analyzer performance statistics will be output when running a build.
When you execute the AL: Package command, you can find the new code analyzer performance statistics in Output.
Total analyzer execution time: 0.074 seconds
NOTE: Elapsed time may be less than analyzer execution time because analyzers can run concurrently
It is classified according to analyzers.
Give it a try!!!😁
Hope this will help.
Thanks for reading.