# CodeCop Analyzer Rules
CodeCop is an analyzer that enforces the official AL Coding Guidelines.
## Rules
Id|Title|Category|Default severity
--|-----------|--------|----------------
codecop-aa0001|There must be exactly one space character on each side of a binary operator such as := + - AND OR =.|Readability|Warning
codecop-aa0002|There must be no space character.|Readability|Warning
codecop-aa0003|There must be exactly one space character between the NOT operator and its argument.|Readability|Warning
codecop-aa0005|Only use BEGIN..END to enclose compound statements.|Readability|Warning
codecop-aa0008|Function calls should have parenthesis even if they do not have any parameters.|Readability|Warning
codecop-aa0013|When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.|Readability|Warning
codecop-aa0018|The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line.|Readability|Warning
codecop-aa0021|Variable declarations should be ordered by type.|Readability|Warning
codecop-aa0022|Substitute the IF THEN ELSE structure with a CASE.|Readability|Warning
codecop-aa0040|Avoid using nested WITH statements.|Readability|Warning
codecop-aa0050|Permission set extensions should not include permissions for objects defined in another application.|Design|Warning
codecop-aa0051|Permission set extensions should not include permission sets defined in another application.|Design|Warning
codecop-aa0052|Permission set extensions should not include permission sets which include permissions for objects defined in another application.|Design|Warning
codecop-aa0053|Permission set extensions should not include wildcard permissions.|Design|Warning
codecop-aa0072|The name of variables and parameters must be suffixed with the type or object name.|Readability|Info
codecop-aa0073|The name of temporary variable must be prefixed with Temp.|Readability|Warning
codecop-aa0074|TextConst and Label variable names should have an approved suffix.|Readability|Warning
codecop-aa0087|Lowering permissions should only be used in tests|Design|Warning
codecop-aa0100|Do not have identifiers with quotes in the name.|Design|Warning
codecop-aa0101|Use camel case property values in pages of type API.|Design|Warning
codecop-aa0102|Use camel case name for field controls in pages of type API.|Design|Warning
codecop-aa0103|Use camel case property values in queries of type API.|Design|Warning
codecop-aa0104|Use camel case name for column controls in queries of type API.|Design|Warning
codecop-aa0105|PagePart controls must not refer to parent pages.|Design|Error
codecop-aa0106|A page of type API can only refer to the same subpage once.|Design|Error
codecop-aa0131|String parameters must match placeholders.|Design|Warning
codecop-aa0136|Do not write code that will never be hit.|Design|Warning
codecop-aa0137|Do not declare variables that are unused.|Design|Warning
codecop-aa0139|Do not assign a text to a target with smaller size.|Design|Warning
codecop-aa0150|Do not declare parameters by reference if their values are never changed.|Design|Warning
codecop-aa0161|Only use AssertError in Test Codeunits.|Design|Warning
codecop-aa0175|Only find record if you need to use it.|Design|Warning
codecop-aa0181|The FindSet() or Find() methods must be used only in connection with the Next() method.|Design|Warning
codecop-aa0189|Only use a correct values of ApplicationArea.|Design|Warning
codecop-aa0194|Only write actions that have an effect.|Design|Warning
codecop-aa0198|Do not use identical names for local and global variables.|Design|Warning
codecop-aa0199|Use only a correct order for ApplicationArea.|Design|Warning
codecop-aa0200|When ApplicationArea is set to 'All', no other values for ApplicationArea should be specified.|Design|Warning
codecop-aa0201|When ApplicationArea is set to 'Basic', you must also specify 'Suite'.|Design|Warning
codecop-aa0202|To avoid confusion, do not give local variables the same name as fields, methods, or actions in the same scope.|Design|Warning
codecop-aa0203|To avoid confusion, do not give methods the same name as fields or actions in the same scope.|Design|Warning
codecop-aa0204|To avoid confusion, do not give global variables the same name as fields, methods, or actions in the same scope.|Design|Warning
codecop-aa0205|Variables must be initialized before usage.|Design|Warning
codecop-aa0206|The value assigned to a variable must be used.|Design|Warning
codecop-aa0207|The EventSubscriber method must be local.|Design|Warning
codecop-aa0210|Avoid non-indexed fields into filtering.|Design|Info
codecop-aa0211|Avoids a runtime error from using CalcFields on a field that is not a FlowField or a field of type Blob.|Design|Warning
codecop-aa0213|Obsoleted object must have a state 'Pending' or 'Removed' and a justification specifying why this field is being obsoleted.|Design|Warning
codecop-aa0214|The local record should be modified before saving to the database.|Design|Warning
codecop-aa0215|Follow the style guide<../../compliance/apptest-bestpracticesforalcode#file-naming> about the best practices for naming.|Readability|Warning
codecop-aa0216|Use a text constant for passing user messages and errors without concatenations.|Localizability|Warning
codecop-aa0217|Use a text constant or label for format string in StrSubstNo.|Localizability|Warning
codecop-aa0218|You must write a tooltip in the Tooltip property for all controls of type Action and Field that exist on page objects.|Localizability|Warning
codecop-aa0219|The Tooltip property of Fields should start with 'Specifies'.|Localizability|Info
codecop-aa0220|The value of the Tooltip property of Fields must be filled.|Localizability|Warning
codecop-aa0221|You must specify a OptionCaption property for all fields which source expressions is not a table field.|Localizability|Warning
codecop-aa0222|SIFT index should not be used on primary or unique key.|Design|Warning
codecop-aa0223|The value of the OptionCaption property of Fields must be filled in.|Localizability|Warning
codecop-aa0224|The count of option captions specified in the OptionCaption property is wrong.|Localizability|Warning
codecop-aa0225|You must specify a caption in the Caption property for Fields that exist on page objects.|Localizability|Warning
codecop-aa0226|The value of the Caption property of Fields must be filled in.|Localizability|Warning
codecop-aa0227|Optional return value should not be omitted in upgrade codeunits.|Design|Warning
codecop-aa0228|The local method must be used; otherwise removed.|Design|Warning
codecop-aa0230|Version should not be specified for internal assemblies.|Design|Warning
codecop-aa0231|StrSubstNo or string concatenation must not be used as a parameter in the Error method.|Design|Warning
codecop-aa0232|The FlowField of a table should be indexed.|Design|Info
codecop-aa0233|Use Get(), FindFirst() and FindLast() without Next() method.|Design|Warning
codecop-aa0234|You should write a tooltip in the Tooltip property for all fields on table objects.|Localizability|Info
codecop-aa0235|When using 'OnInstallAppPerCompany' you should also add 'Company-Initialize'::'OnCompanyInitialize' event subscriber.|Design|Info
codecop-aa0237|The name of non-temporary variables must not be prefixed with Temp.|Readability|Warning
codecop-aa0240|Email and Phone No must not be present in any part of the source code.|Design|Warning
codecop-aa0241|Use all lowercase letters for reserved language keywords.|Readability|Hidden
codecop-aa0242|Limit JIT loads by selecting all fields for load.|Design|Warning
codecop-aa0243|Running an upgrade codeunit is not allowed.|Design|Warning
codecop-aa0244|Do not use identical names for parameters and global variables.|Design|Warning
codecop-aa0245|To avoid confusion, do not give parameters the same name as fields, methods, or actions in the same scope.|Design|Warning
codecop-aa0246|Suppressing all diagnostics is not allowed.|Design|Warning
codecop-aa0247|Use namespaces.|Design|Info
codecop-aa0248|Add 'this' qualification to improve readability.|Readability|Hidden
codecop-aa0249|PageField trigger is unused due to a property value.|Design|Warning
codecop-aa0250|External business event should have obsolete marker.|Design|Warning
codecop-aa0251|External business event with obsolete marker must have the obsolete attribute set.|Design|Error
codecop-aa0252|Moving external business events to another app is not allowed.|Design|Error
codecop-aa0448|You must use the FieldCaption method instead of the FieldName method and TableCaption method instead of TableName method.|Localizability|Warning
codecop-aa0462|The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols.|Localizability|Warning
codecop-aa0470|Placeholders should have a comment explaining their content.|Localizability|Warning
codecop-aa0471|Page control fields of type 'Decimal' must have the property AutoFormatType specified.|Localizability|Info
codecop-aa0472|Page control fields having amount AutoFormatType defined must have the property AutoFormatExpression specified.|Localizability|Info
codecop-aa0473|Table control fields of type 'Decimal' must have the property AutoFormatType specified.|Localizability|Info
codecop-aa0474|Table control fields that have amount AutoFormatType defined, must have the property AutoFormatExpression specified.|Localizability|Info
codecop-aa0475|Truncate can only be used on normal tables without media fields and outside of try functions.|Design|Error
codecop-aa0476|The AI test configuration is not valid.|Design|Error
codecop-aa0477|Unordered using statements|Readability|Info
## Related information
../devenv-using-code-analysis-tool
../devenv-rule-set-syntax-for-code-analysis-tools
../devenv-using-code-analysis-tool-with-rule-set

Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact. https://jonas-paprotka.de/docs/dev-itpro/developer/analyzers/codecop/
