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
AA0073 The name of temporary variable must be prefixed with Temp. Only temporary variable names must be prefixed with Temp. The name of temporary variable '{0}' must be prefixed with Temp. 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
AA0150 Do not declare parameters by reference if their values are never changed. Do not declare parameters by reference if their values are never changed. Parameter '{0}' is declared by reference but never changed in method '{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
AA0181 The FindSet() or Find() methods must be used only in connection with the Next() method. Avoid getting the dataset when an enumeration is not used, which will decrease performance. The FindSet() or Find() method on the record '{0}' must be used only in connection with the Next() method. 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
AA0205 Variables must be initialized before usage. Always initialize a variable before usage. This can improve readability and make debugging easier. Use of unassigned variable '{0}'. Design Warning true
AA0206 The value assigned to a variable must be used. The value assigned to a variable must be used, otherwise the variable is not necessary. The variable '{0}' is initialized but not used. Design Warning true
AA0207 The EventSubscriber method must be local. The EventSubscriber method must be local. The EventSubscriber method {0} must be local. Design Warning true
AA0210 Avoid non-indexed fields into filtering. Suboptimal index. The table {0} does not contain a 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 style guide about the best practices for naming. Follow the style guide about the best practices for naming. The file {0} has an incorrect name. The valid name is {1}. Readability 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
AA0217 Use a text constant or label for format string in StrSubstNo. Use a text constant or label for format string in StrSubstNo. Use a text constant or label for format string in StrSubstNo. Localizability Warning true
AA0218 You must write a tooltip in the Tooltip property for all controls of type Action and Field that exist on page objects. See the style guide for more information. You must write a tooltip in the Tooltip property for all controls of type Action and Field that exist on page objects. See the style guide for more information. The Tooltip property for {0} {1} must be filled. Localizability Warning true
AA0219 The Tooltip property of Fields must start with 'Specifies'. See the style guide for more information. The Tooltip property of Fields must start with 'Specifies'. See the style guide for more information. The Tooltip property for {0} {1} must start with 'Specifies'. Localizability Warning false
AA0220 The value of the Tooltip property of Fields must be filled. See the style guide for more information. The value of the Tooltip property of Fields must be filled. See the style guide for more information. The value of the {0} Tooltip property for {1} {2} must be filled. Localizability Warning true
AA0221 You must specify a OptionCaption property for all fields which source expressions is not a table field. You must specify a OptionCaption property for all fields which source expressions is not a table field. The OptionCaption property for {0} {1} must be filled in. Localizability Warning true
AA0222 SIFT index should not be used on primary or unique key. SIFT index should not be used on primary or unique key. SIFT index should not be used on key {0}. Design Warning true
AA0223 The value of the OptionCaption property of Fields must be filled in. The value of the OptionCaption property of Fields must be filled in. The value of the {0} OptionCaption property for {1} {2} must be filled in. Localizability Warning true
AA0224 The count of captions property is wrong. The count of captions property is wrong. The count of captions property for {0} {1} is wrong. Localizability Warning true
AA0225 You must specify a caption in the Caption property for Fields that exist on page objects. You must specify a caption in the Caption property for Fields that exist on page objects. The Caption property for {0} {1} must be filled in. Localizability Warning true
AA0226 The value of the Caption property of Fields must be filled in. The value of the Caption property of Fields must be filled in. The value of the {0} Caption property for {1} {2} must be filled in. Localizability Warning true
AA0227 Optional return value should not be omitted in upgrade codeunits. In upgrade codeunits always remember to specify optional return values on methods that can cause run-time errors. Optional return value of the method should not be omitted in upgrade codeunits. Design Warning true
AA0228 The local method must be used; otherwise removed. The local method must be used, otherwise the variable is not necessary. The local method '{0}' is declared but never used. Design Warning true
AA0230 Version should not be specified for internal assemblies. Version number should not be specified for internal assemblies to avoid errors during upgrade procedures. Version should not be specified for internal assembly '{0}'. Design Warning true
AA0231 StrSubstNo or string concatenation must not be used as a parameter in the Error method. The data classification context will be lost when using the StrSubstNo method or string concatenation as a parameter in the Error method. Instead use the ability of the Error method to insert values into the string with placeholders. Do not use the StrSubstNo or string concatenation as a parameter in the Error method. Design Warning true
AA0232 The FlowField of a table should be indexed. You can potentially increase performance if fields that are used in FlowFields are added to SumIndexedFields of the corresponding key. The FlowField {0} of {1} should be added to the SIFT key. Design Info true
AA0233 Use Get(), FindFirst() and FindLast() without Next() method. Avoid enumeration of a dataset when the dataset is not filtered. The '{0}' method on the record '{1}' must be used without the Next() method. Design Warning true
AA0235 When using 'OnInstallPerCompany' you must also add 'OnCompanyInitialize' subscription. When using trigger 'OnInstallPerCompany' in a codeunit with 'Subtype = Install' you must also add a 'Company - Initialize'::'OnCompanyInitialize' subscription. Codeunit '{0}' must contain the 'OnCompanyInitialize' subscription. Design Info true
AA0237 The name of non-temporary variables must not be prefixed with Temp. Only temporary variable names must be prefixed with Temp. The name of non temporary variables '{0}' must not be prefixed with Temp. Readability Warning true
AA0240 Email and Phone No must not be present in any part of the source code. Email and Phone No must not be present in any part of the source code that might be collected as telemetry data. The {0} '{1}' must not be contain Email or Phone No. Design Warning true
AA0448 You must use the FieldCaption method instead of the FieldName method and TableCaption method instead of TableName method. If you want to enable your application for multilanguage functionality, you must use the FieldCaption and TableCaption methods instead of the FieldName and TableName methods. Use FieldCaption instead of FieldName and TableCaption instead of TableName in methods that display messages. Localizability Warning true
AA0470 Placeholders should have a comment explaining their content. Provide an explanation that describes the content of each of the placeholders. Variable '{0}' with placeholders should have a comment explaining their content. Localizability Warning true

See Also

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