Configuration

ALCops supports several mechanisms to configure which rules are active and how they behave. These mechanisms work across all environments: VS Code, command line, and CI/CD pipelines.

alcops.json

The alcops.json file provides analyzer-specific configuration. Place it in the root of your AL project alongside app.json.

{
    "cognitiveComplexityThreshold": 15,
    "cyclomaticComplexityThreshold": 8,
    "maintainabilityIndexThreshold": 20
}

Available properties

PropertyTypeDefaultDescription
cognitiveComplexityThresholdinteger15Maximum cognitive complexity before a diagnostic is reported
cyclomaticComplexityThresholdinteger8Maximum cyclomatic complexity before a diagnostic is reported
maintainabilityIndexThresholdinteger20Minimum maintainability index before a diagnostic is reported
languagesToTranslatestring[]nullLanguage codes to check for missing translations
namingPatternsobjectnullPer-target naming pattern overrides
useSequentialGuidScopestringnullSet to "AllGuidFields" to require sequential GUIDs on all GUID fields

Property names are case-insensitive. Comments and trailing commas are allowed.

namingPatterns

Override the default naming validation patterns per target. Each target accepts allowPattern, disallowPattern, allowDescription, and disallowDescription.

{
    "namingPatterns": {
        "Variable": {
            "allowPattern": "^[A-Z]",
            "allowDescription": "should start with an uppercase letter"
        },
        "EnumValue": {
            "disallowPattern": "^_",
            "disallowDescription": "should not start with an underscore"
        }
    }
}

Valid targets: Procedure, LocalProcedure, GlobalProcedure, EventSubscriber, EventDeclaration, Variable, Parameter, ReturnValue, Object, Field, Action, EnumValue, Control.

LocalProcedure, GlobalProcedure, EventSubscriber, and EventDeclaration inherit from Procedure when no explicit override is configured.

languagesToTranslate

Specify which language codes must have translations present in the .xlf files.

{
    "languagesToTranslate": ["da-DK", "de-DE"]
}

Ruleset Files (.ruleset.json)

Ruleset files are the standard Microsoft mechanism for configuring diagnostic severity. Create a .ruleset.json file and reference it in your app.json or VS Code settings.

{
    "name": "My Project Ruleset",
    "rules": [
        {
            "id": "AC0001",
            "action": "Warning"
        },
        {
            "id": "LC0007",
            "action": "None"
        },
        {
            "id": "PC0006",
            "action": "Error"
        }
    ]
}

Supported actions:

ActionEffect
ErrorTreat the diagnostic as a build error.
WarningTreat the diagnostic as a warning (default for most rules).
InfoTreat the diagnostic as an informational message.
HiddenHide the diagnostic but keep it active (visible in code actions).
NoneDisable the diagnostic entirely.

For full details, see the Microsoft documentation on ruleset files .

Pragma Directives

Use #pragma warning directives to suppress specific diagnostics inline:

#pragma warning disable AC0001
table 50100 MyTable
{
    // AC0001 is suppressed for this block
}
#pragma warning restore AC0001

This is useful for targeted suppression where a ruleset-level change would be too broad.