CodeCop Analyzer Rules

CodeCop is an analyzer that enforces the official AL Coding Guidelines.

Rules

Id Title Description MessageFormat Category Default Severity IsEnabledbyDefault
AA0001 There must be exactly one space character on each side of a binary operator such as := + - AND OR =. There must be exactly one space character on each side of a binary operator such as := + - AND OR =. The parameter comma operator however, should have no spaces. There must be exactly one space character on each side of '{0}'. Readability Warning true
AA0002 There must be no space character. There must be no space character between a unary operator and its argument. There must be no space character after '{0}'. Readability Warning true
AA0003 There must be exactly one space character between the NOT operator and its argument. There must be exactly one space character between the NOT operator and its argument. There must be exactly one space character after '{0}'. Readability Warning true
AA0005 Only use BEGIN..END to enclose compound statements. Only use BEGIN..END to enclose compound statements. Only use BEGIN..END to enclose compound statements. Readability Warning true
AA0008 Function calls should have parenthesis even if they do not have any parameters. Use parenthesis in a function call even if the function does not have any parameters. You must specify open and close parenthesis after '{0}'. Readability Warning true
AA0013 When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character. When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character. When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character. Readability Warning true
AA0018 The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line. The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line. The '{0}' keyword should always start a line. Readability Warning true
AA0021 Variable declarations should be ordered by type. Variable declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. Variable declarations should be ordered by type. Variables should be sorted like this: Record, Report, Codeunit, XmlPort, Page, Query, Notification, BigText, DateFormula, RecordId, RecordRef, FieldRef, and FilterPageBuilder. The rest of the variables are not sorted. Readability Warning true
AA0022 Substitute the IF THEN ELSE structure with a CASE. An IF followed by two or more ELSE IF should be replaced with a CASE. Substitute the IF THEN ELSE structure with a CASE. Readability Warning true
AA0040 Avoid using nested WITH statements. It can be difficult to see what variable that a member variable or function refers to, when nesting WITH statements of variables with different types. This WITH statement is nested inside another WITH statement at '{0}'. Readability Warning true
AA0074 TextConst and Label variable names should have an approved suffix. TextConst and Label variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage. Variable '{0}' must have a suffix from this list: Msg, Tok, Err, Qst, Lbl, Txt. Readability Warning true
AA0087 Lowering permissions should only be used in tests Do only lower permissions inside procedures of type test. Do only lower permissions inside procedures of type test. Design Warning true
AA0100 Do not have identifiers with quotes in the name. Do not have identifiers with quotes in the name. Do not have identifiers with quotes in the name. Design Warning true
AA0101 Use camel case property values in pages of type API. For pages of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName value should be camel-cased to follow the Microsoft REST API Guidelines. For pages of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName should be camel-cased. Design Warning true
AA0102 Use camel case name for field controls in pages of type API. Field controls in pages of type API should have a camel case name in order to follow the Microsoft REST API Guidelines. Field controls in pages of type API should have a camel case name. Design Warning true
AA0103 Use camel case property values in queries of type API. For queries of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName value should be camel-cased to follow the Microsoft REST API Guidelines. For queries of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName should be camel-cased. Design Warning true
AA0104 Use camel case name for column controls in queries of type API. Column controls in queries of type API should have a camel case name in order to follow the Microsoft REST API Guidelines. Column controls in queries of type API should have a camel case name. Design Warning true
AA0105 PagePart controls must not refer to parent pages. PagePart controls must not refer to parent pages. PagePart controls must not refer to parent pages. Design Error true
AA0106 A page of type API can only refer to the same subpage once. A page of type API can only refer to the same subpage once. A page of type API can only refer to the same subpage once. Design Error true
AA0131 String parameters must match placeholders. Remember to specify all string parameters to match placeholders. The number of parameters passed to a string must match the placeholders. Design Warning true
AA0136 Do not write code that will never be hit. Do not write code that will never be hit. Unreachable code detected. Design Warning true
AA0137 Do not declare variables that are unused. Do not declare variables that are unused. Variable '{0}' is unused in '{1}'. Design Warning true
AA0139 Do not assign a text to a target with smaller size. Do not assign a text to a target with smaller size. Possible overflow assigning '{0}' to '{1}'. Design Warning true
AA0161 Only use AssertError in Test Codeunits. Only use AssertError in Test Codeunits. Only use AssertError in Test Codeunits. Design Warning true
AA0175 Only find record if you need to use it. Only find or get records if you are not using values. Variable '{0}' queries the database in '{1}' but does not use the queried record. Only find or get record if you need to access the values. Consider using ISEMPTY. Design Warning true
AA0189 Only use a correct values of ApplicationArea. ApplicationArea has invalid value. Value '{0}' found on control {1} {2}. Valid values are {3}. Design Warning true
AA0194 Only write actions that have an effect. Remember to specify either the 'OnAction' trigger or 'RunObject' property on an action. Remember to specify either the 'OnAction' trigger or 'RunObject' property on an action. Design Warning true
AA0198 Do not use identical names for local and global variables. Do not use identical names for local and global variables. The name of the local variable '{0}' is identical to a global variable. Design Warning true
AA0199 Use only a correct order for ApplicationArea. The order of the specified ApplicationArea is incorrect. Value '{0}' found on control {1} {2}. Incorrect order, expected order is: {3}. Design Warning true
AA0200 When ApplicationArea is set to 'All', no other values for ApplicationArea should be specified. 'All' should always stand alone has incorrect order. Value '{0}' found on control {1} {2}. When ApplicationArea is set to 'All', no other values for ApplicationArea should be specified. Design Warning true
AA0201 When ApplicationArea is set to 'Basic', you must also specify 'Suite'. When ApplicationArea is set to 'Basic', you must also specify 'Suite'. Value '{0}' found on control {1} {2}. When ApplicationArea is set to 'Basic', you must also specify 'Suite'. Design Warning true
AA0462 The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols. The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the < > symbols. The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols. Localizability Warning true
AA0202 To avoid confusion, do not give local variables the same name as fields, methods or actions in the same scope. To avoid confusion, do not give local variables the same name as fields, methods or actions in the same scope. The name of the local variable '{0}' is identical to a field, method or action in the same scope. Design Warning true
AA0203 To avoid confusion, do not give methods the same name as fields or actions in the same scope. To avoid confusion, do not give methods the same name as fields or actions in the same scope. The name of the method '{0}' is identical to a field or action in the same scope. Design Warning true
AA0204 To avoid confusion, do not give global variables the same name as fields, methods or actions in the same scope. To avoid confusion, do not give global variables the same name as fields, methods or actions in the same scope. The name of the global variable '{0}' is identical to a field, method or action in the same scope. Design Warning true
AA0210 Avoid non-indexed fields into filtering. Suboptimal index. The table {0} does not contain the key with the field {1}. Design Info true
AA0211 Avoids a runtime error from using CalcFields on a field that is not a FlowField or a field of type Blob. CalcFields should only be used for FlowFields or Blob fields The CalcFields method should only be used with FlowFields or fields of type Blob. The field {0} is not a FlowField or of type Blob. Design Warning true
AA0213 Obsoleted object must have a state 'Pending' or 'Removed' and a justification specifying why this field is being obsoleted. Obsoleted object must have a state 'Pending' or 'Removed' and a justification specifying why this field is being obsoleted. The {0} {1} must have specified ObsoleteState and ObsoleteReason. Design Warning true
AA0214 The local record should be modified before saving to the database. The local record should be modified before saving to the database. The record {0} should be modified before saving to the database. Design Warning true
AA0215 Follow the best practices for naming ('https://docs.microsoft.com/dynamics365/business-central/dev-itpro/compliance/apptest-bestpracticesforalcode#file-naming'). Follow the best practices for naming ('https://docs.microsoft.com/dynamics365/business-central/dev-itpro/compliance/apptest-bestpracticesforalcode#file-naming'). The file {0} has an incorrect name. The valid name is {1}. Redability Warning true
AA0216 Use a text constant for passing user messages and errors without concatenations. Use a text constant for passing user messages and errors without concatenations. Use a text constant for passing user messages and errors without concatenations. Localizability Warning true

See Also

Using the Code Analysis Tool
Ruleset for the Code Analysis Tool
Using the Code Analysis Tools with the Ruleset