Blog title card with code, gear, filter, and pipeline icons reading Integrating Custom CodeCop with AL:Go.

Integrating custom CodeCop with AL:Go pipelines

2 min read

Let’s continue our AL:Go pipelines Blog series.

Extending Business Central’s static analysis with your own CodeCop rules is a powerful way to enforce team-specific best practices and catch domain-specific pitfalls early.

AL:Go’s built-in customCodeCops parameter makes it trivial to drop your own CodeCop analyzer DLL into your Business Central build container.

In this demo we will be focusing on adding LinerCop CodeCop to your pipelines.

This code analyzer is meant to check your code for all sorts of problems. Be it code that technically compiles but will generate errors during runtime or more a kind of guideline check to achieve cleaner code. 


Standard CodeCops

Before jumping into custom CodeCop, let’s check out parameters for standard Microsoft CodeCops:

JSON
  "enableCodeCop": true,
  "enableAppSourceCop": true,
  "enablePerTenantExtensionCop": true,
  "enableUICop": true,
  "enableCodeAnalyzersOnTestApps": true,

AL-Go settings.json with CodeCop, AppSourceCop, PerTenantExtensionCop, UICop, and analyzers on test apps enabled.

Let’s unpack each setting:

  • enableCodeCop Turns on the classic CodeCop rules that enforce AL best practices (naming conventions, unnecessary loops, performance traps, etc.). This is your baseline for clean, maintainable AL code.
  • enableAppSourceCop Validates your extension against AppSource certification requirements: object IDs, localized labels, telemetry settings, and mandatory metadata. It’s essential if you plan to publish to Microsoft AppSource.
  • enablePerTenantExtensionCop Checks for your per tenant extension compatibility issues— if you don’t plan to publish to Microsoft AppSource, it means you will be using your app as PTE, so enabling this CodeCop would be a good idea.. Enable this to catch platform-incompatible code early.
  • enableUICop Applies UI-specific rules: page layout recommendations, accessibility checks, and consistency of captions/tooltips. A must for any app surface area your end users will see.
  • enableCodeAnalyzersOnTestApps By default, analyzers skip code in test projects. Setting this to true forces CodeCop and friends to run against your test AL apps too—catch dead code, misnamed tests, or unsupported test-only patterns.

GitHub Actions build log showing analyzer and AppSourceCop errors highlighted in pipeline output.

As you can see, now pipeline is running with enabled CodeCop’s, in this case intentionally left errors and enabled AppSource cop, which got errors in pipeline.


Custom CodeCops (Business Central LinerCop)

Let’s move now to custom CodeCops like LinerCop.

First I downloaded LinterCop and added it to code analyzers:

VS Code settings.json configuring al.codeAnalyzers to include the BusinessCentral.LinterCop DLL.

Made example which will trigger LinterCop rule:

AL page extension code triggering a LinterCop rule warning about using object ID in variable declaration.

LC0024 – LinterCop Rule Link

So, that’s how it’s working locally. But how to enable it automatically to validate on pipeline CI/CD build?

In AL-Go settings file you have parameter:

customCodeCopsCustomCodeCops is an array of paths or URLs to custom Code Cop DLLs you want to enable when building.[ ]

So, where to get that DLL? For LinterCop, it’s available on GitHub public repository, under releases:

Releases · StefanMaron/BusinessCentral.LinterCop

Just copy link to a DLL:

Release assets list highlighting BusinessCentral.LinterCop DLL download link.

Add it under AL-Go Settings.json:

AL-Go settings.json showing customCodeCops configured with a direct LinterCop DLL URL.

Let’s run now the pipeline!

GitHub Actions build log confirming BusinessCentral.LinterCop analyzer DLL is downloaded and used during compilation.

Custom CodeCop is downloaded into the container, and its rules are validated. Simple as that!


By adding custom CodeCops into your pipeline, you increase your organization’s standards, reduce manual code reviews, and ship higher-quality extensions faster. Go ahead—define the rules that matter most to your team, and let your pipeline enforce them! 🚀

Related posts

Comments

    Leave a comment

    Reviewed before it appears.