{ "$id": "https://raw.githubusercontent.com/ALCops/Analyzers/main/src/ALCops.Common/Settings/alcops.schema.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "ALCops Settings", "description": "Schema for the alcops.json configuration file used by ALCops code analyzers for AL (Microsoft Dynamics 365 Business Central).", "type": "object", "additionalProperties": false, "properties": { "$schema": { "type": "string", "format": "uri", "description": "URL to the ALCops settings JSON schema. Adding this property enables IntelliSense in editors that support JSON Schema without the ALCops VS Code extension." }, "CognitiveComplexityThreshold": { "type": "integer", "default": 15, "minimum": 0, "description": "The threshold for the Cognitive Complexity check. Cognitive Complexity measures how difficult code is to understand by counting nested control flow structures and logical operator sequences. Used by LC0090. Default: 15" }, "CyclomaticComplexityThreshold": { "type": "integer", "default": 8, "minimum": 0, "description": "The threshold for the Cyclomatic Complexity check. Cyclomatic Complexity counts the number of independent code paths (decisions) through a method. Used by LC0010. Default: 8" }, "MaintainabilityIndexThreshold": { "type": "integer", "default": 20, "minimum": 0, "maximum": 100, "description": "The threshold (0-100) for the Maintainability Index check. A higher value indicates more maintainable code. Methods scoring at or below this threshold trigger a warning. Used by LC0008. Default: 20" }, "LanguagesToTranslate": { "type": "array", "items": { "type": "string", "pattern": "^[a-z]{2,3}(-[A-Z]{2})?$", "examples": ["da-DK", "de-DE", "fr-FR", "nl-NL", "es-ES"] }, "uniqueItems": true, "description": "List of language codes that translatable text must be translated into. When set, only XLIFF files matching these languages are checked. When omitted, languages are discovered from available XLIFF files. Used by LC0091." }, "SubscriberNamingPattern": { "type": ["string", "null"], "default": null, "description": "Template for event subscriber procedure names. Placeholders: {Event Source}/{Event Name}/{Element Name} (raw, emitted verbatim without word splitting or casing transforms), {EventSource} (PascalCase), {eventSource} (camelCase), {event_source} (snake_case), {event-source} (kebab-case). Same style variants exist for {EventName} and {ElementName}. Wrap a sub-template in [...] to emit it only when all token placeholders inside resolve to a non-empty value, e.g. '{Event Source}_{Event Name}[_{Element Name}]' emits the underscore and element name only when ElementName is set. Used by LC0098. Default: null (uses built-in template '{Event Source}_{Event Name}[_{Element Name}]', which matches the identifier the AL Language extension's Find Event feature generates)." }, "NamingPatterns": { "type": "object", "description": "Custom naming convention patterns per target kind. Keys are naming target names (case-insensitive). Each target can define AllowPattern (regex that names must match) and DisallowPattern (regex that names must not match). Sub-targets LocalProcedure, GlobalProcedure, EventSubscriber, and EventDeclaration inherit from Procedure if not explicitly overridden. Used by LC0092.", "propertyNames": { "enum": [ "Procedure", "LocalProcedure", "GlobalProcedure", "EventSubscriber", "EventDeclaration", "Variable", "LocalVariable", "GlobalVariable", "Parameter", "VarParameter", "ReturnValue", "Object", "Field", "Action", "EnumValue", "Control" ] }, "additionalProperties": { "$ref": "#/$defs/NamingPattern" } }, "UseSequentialGuidScope": { "type": ["string", "null"], "enum": ["AllGuidFields", null], "default": null, "description": "Controls the scope of the sequential GUID check. When set to 'AllGuidFields', all CreateGuid() calls are flagged, not just those in primary key fields. Used by PC0029. Default: null" }, "ToolTipAllowedPunctuations": { "type": "array", "items": { "$ref": "#/$defs/Punctuation" }, "default": [ { "Character": ".", "Name": "dot" } ], "description": "The set of allowed ending punctuations for tooltip text. Used by AC0014. Default: [{\"Character\":\".\",\"Name\":\"dot\"}]" }, "KnownAcronyms": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true, "description": "Additional acronyms whose canonical casing is used when generating identifier fragments from all-lowercase source words. Original casing wins for the preferred name: if the source word already contains any uppercase character, its casing is preserved and the CodeFix always suggests that spelling. Only all-lowercase source words fall back to the registry, resolving e.g. 'vat' -> 'VAT', 'odata' -> 'OData', 'acme' -> 'Acme'. When the source word already carries uppercase and an entry with a different casing on the same case-insensitive key is registered here (e.g. source 'LCY' + entry 'Lcy'), that entry is additionally accepted alongside the original spelling; the CodeFix continues to suggest the original casing. Entries are matched case-insensitively. Merged with the built-in default list; user entries override built-ins on identical case-insensitive keys. If multiple entries resolve to the same case-insensitive key, exactly one canonical form is kept and the last entry wins." }, "StatementBlockSpacing": { "type": "object", "additionalProperties": false, "description": "Configuration for FC0007 (Statement blocks should be separated by a blank line). Controls which spacing checks are performed around control-flow blocks and scope-leaving statements.", "properties": { "ControlFlowBefore": { "type": "boolean", "default": true, "description": "Require a blank line before a multi-line control-flow block (if, case, repeat, while, for, foreach) when it follows another statement in the same block. Used by FC0007. Default: true" }, "ControlFlowAfter": { "type": "boolean", "default": true, "description": "Require a blank line after a multi-line control-flow block when a non-control-flow statement directly follows it in the same block. Used by FC0007. Default: true" }, "ScopeLeavingMode": { "type": "string", "enum": ["Off", "ExitOnly", "ErrorOnly", "ExitAndError"], "default": "ExitAndError", "description": "Which scope-leaving statements require a blank line before them. 'Off' disables the check, 'ExitOnly' checks only 'exit', 'ErrorOnly' checks built-in 'Error(...)' and 'FieldError(...)', 'ExitAndError' checks all three. Used by FC0007. Default: ExitAndError" }, "ElseChainBeforeMode": { "type": "string", "enum": ["Off", "RequireBlank"], "default": "Off", "description": "Whether a blank line is required before the 'else' keyword of a multi-line 'if ... then begin ... end else ...' construct. 'Off' does not enforce, 'RequireBlank' reports when the closing 'end' and 'else' are not separated by a blank line. Used by FC0007. Default: Off" }, "OneLinerMode": { "type": "string", "enum": ["None", "All"], "default": "None", "description": "Whether single-line control-flow statements (e.g. 'if Flag then Message(x);' fully on one source line) participate in the ControlFlowBefore/ControlFlowAfter checks. 'None' excludes one-liners, 'All' includes them. Used by FC0007. Default: None" } } } }, "$defs": { "NamingPattern": { "type": "object", "description": "Naming pattern configuration for a specific target kind.", "additionalProperties": false, "properties": { "AllowPattern": { "type": "string", "description": "A regular expression that the name must match. If the name does not match, a warning is reported. Example: \"^[A-Z]\" requires names to start with an uppercase letter." }, "DisallowPattern": { "type": "string", "description": "A regular expression that the name must not match. If the name matches, a warning is reported. Example: \"[%&!?]\" disallows special characters." }, "AllowDescription": { "type": "string", "description": "A human-readable description shown in the diagnostic message when AllowPattern is violated. Example: \"should start with an uppercase letter\"" }, "DisallowDescription": { "type": "string", "description": "A human-readable description shown in the diagnostic message when DisallowPattern is violated. Example: \"should not contain special characters\"" } } }, "Punctuation": { "type": "object", "description": "Definition of allowed punctuations like '.', '!' for the end of tooltips.", "additionalProperties": false, "properties": { "Character": { "type": "string", "description": "A character allowed as punctuation (i.e. '.', '!')." }, "Name": { "type": "string", "description": "A name of the allowed character (i.e. 'dot', 'exclamation mark')." } } } } }