Hougaard.com – Applied Hacking

All the CodeCop Rules

Here is a list of current (4.0.229714) CodeCop rules: (Should be the same as this page https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop ) but there’s some minor differences, behind the scene there are two 199 rules.

AL0003 UnaryOperatorSpacing There must be exactly one space character between the NOT operator and its argument.
AL0087 DoOnlyLowerPermissionsInsideTestProcedures Do only lower permissions inside procedures of type test.
AL0462 CalcDateOnlyWithDateFormulaUsage The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols.
AL0210 SuboptimalIndex Avoid non-indexed fields into filtering.
0103 UseCamelCasePropertyValuesForApiQueries Use camel case property values in queries of type API.
AL0003 UnaryOperatorSpacing There must be exactly one space character between the NOT operator and its argument.
AL0189 ApplicationAreaHasInvalidValue Only use a correct values of ApplicationArea.
AL0021 VariableDeclarationsShouldBeOrderedByType Variable declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables.
AL0199 ApplicationAreaIncorrectOrder Use only a correct order for ApplicationArea.
AL0087 DoOnlyLowerPermissionsInsideTestProcedures Lowering permissions should only be used in tests
AL0200 ApplicationAreaAllShouldBeAloneMessageFormat Value ‘{0}’ found on control {1} {2}. When ApplicationArea is set to ‘All’, no other values for ApplicationArea should be specified.
AL0013 TrailingBeginShouldBeOnTheSameLine When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.
AL0101 UseCamelCasePropertyValuesForApiPagesMessageFormat For pages of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName should be camel-cased.
AL0201 ApplicationAreaBasicAndSuite When ApplicationArea is set to ‘Basic’, you must also specify ‘Suite’.
AL0008 UseParenthesisForFunctionCall Function calls should have parenthesis even if they do not have any parameters.
AL0203 DoNotNameMethodAsField To avoid confusion, do not give methods the same name as fields or actions in the same scope.
AL0161 OnlyUseAssertErrorInTestCodeunits Only use AssertError in Test Codeunits.
AL0203 DoNotNameMethodAsFieldMessageFormat The name of the method ‘{0}’ is identical to a field or action in the same scope.
AL0139 DoNotAssignToStringWithSmallerCapacityMessageFormat Possible overflow assigning ‘{0}’ to ‘{1}’.
AL0022 SubstituteIfElseWithCaseStatementIfMoreThanTwoAlternatives Substitute the IF THEN ELSE structure with a CASE.
AL0001 BinaryOperatorSpacing 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.
AL0202 DoNotNameLocalVarAsFieldOrMethodMessageFormat The name of the local variable ‘{0}’ is identical to a field, method or action in the same scope.
AL0161 OnlyUseAssertErrorInTestCodeunits Only use AssertError in Test Codeunits.
AL0161 OnlyUseAssertErrorInTestCodeunitsMessageFormat Only use AssertError in Test Codeunits.
AL0102 UseCamelCaseFieldNamesForApiPages Use camel case name for field controls in pages of type API.
AL0018 KeywordShouldBeFirstOnLine The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line.
AL0462 CalcDateOnlyWithDateFormulaUsageMessageFormat The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols.
AL0175 DoNotFindRecordAndNotUseMessageFormat 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.
AL0102 UseCamelCaseFieldNamesForApiPagesMessageFormat Field controls in pages of type API should have a camel case name.
AL0101 UseCamelCasePropertyValuesForApiPages 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.
AL 0040 DoNotNestWiths 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.
AL0194 DoNotWriteActionsWithNoEffectMessageFormat Remember to specify either the ‘OnAction’ trigger or ‘RunObject’ property on an action.
AL0013 TrailingBeginShouldBeOnTheSameLineMessageFormat When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.
AL0131 StringParamsMustMatchPlaceholders Remember to specify all string parameters to match placeholders.
AL0199 ApplicationAreaIncorrectOrder The order of the specified ApplicationArea is incorrect.
AL0003 UnaryOperatorSpacingMessageFormat There must be exactly one space character after ‘{0}’.
AL0104 UseCamelCaseColumnNamesForApiQueries Column controls in queries of type API should have a camel case name in order to follow the Microsoft REST API Guidelines.
AL0018 KeywordShouldBeFirstOnLine The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line.
AL0202 DoNotNameLocalVarAsFieldOrMethod To avoid confusion, do not give local variables the same name as fields, methods or actions in the same scope.
AL0136 DoNotWriteCodeThatWillNeverBeHit Do not write code that will never be hit.
AL0040 DoNotNestWiths Avoid using nested WITH statements.
AL0074 TextConstLabelVariableNamesShouldHaveApprovedSuffixMessageFormat Variable ‘{0}’ must have a suffix from this list: Msg, Tok, Err, Qst, Lbl, Txt.
AL0001 BinaryOperatorSpacing There must be exactly one space character on each side of a binary operator such as := + – AND OR =.
AL0201 ApplicationAreaBasicAndSuiteMessageFormat Value ‘{0}’ found on control {1} {2}. When ApplicationArea is set to ‘Basic’, you must also specify ‘Suite’.
AL0074 TextConstLabelVariableNamesShouldHaveApprovedSuffix TextConst and Label variable names should have an approved suffix.
AL0002 UnaryOperatorNoSpacing There must be no space character between a unary operator and its argument.
AL0139 DoNotAssignToStringWithSmallerCapacity Do not assign a textto a target with smaller size.
AL0175 DoNotFindRecordAndNotUse Only find record if you need to use it.
AL0021 VariableDeclarationsShouldBeOrderedByType Variable declarations should be ordered by type.
AL0013 TrailingBeginShouldBeOnTheSameLine When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.
AL0005 OnlyUseBeginEndForCompoundStatements Only use BEGIN..END to enclose compound statements.
AL0005 OnlyUseBeginEndForCompoundStatements Only use BEGIN..END to enclose compound statements.
AL0136 DoNotWriteCodeThatWillNeverBeHitMessageFormat Unreachable code detected.
AL0087 DoOnlyLowerPermissionsInsideTestProceduresMessageFormat Do only lower permissions inside procedures of type test.
AL0189 ApplicationAreaHasInvalidValueMessageFormat Value ‘{0}’ found on control {1} {2}. Valid values are {3}.
AL0105 PagePartMustNotReferToParentPageMessageFormat PagePart controls must not refer to parent pages.
AL0203 DoNotNameMethodAsField To avoid confusion, do not give methods the same name as fields or actions in the same scope.
AL0131 StringParamsMustMatchPlaceholders String parameters must match placeholders.
AL0106 ApiPageCanOnlyReferToTheSameSubpageOnceMessageFormat A page of type API can only refer to the same subpage once.
AL0103 UseCamelCasePropertyValuesForApiQueriesMessageFormat For queries of the type API the value of properties APIPublisher, APIGroup, EntityName, and EntitySetName should be camel-cased.
AL0189 ApplicationAreaHasInvalidValue ApplicationArea has invalid value.
AL0008 UseParenthesisForFunctionCallMessageFormat You must specify open and close parenthesis after ‘{0}’.
AL0104 UseCamelCaseColumnNamesForApiQueries Use camel case name for column controls in queries of type API.
AL0002 UnaryOperatorNoSpacing There must be no space character.
0001 BinaryOperatorSpacingMessageFormat There must be exactly one space character on each side of ‘{0}’.
AL0200 ApplicationAreaAllShouldBeAlone When ApplicationArea is set to ‘All’, no other values for ApplicationArea should be specified.
AL0198 GlobalLocalVariablesShouldNotHaveSameName Do not use identical names for local and global variables.
AL0102 UseCamelCaseFieldNamesForApiPages Field controls in pages of type API should have a camel case name in order to follow the Microsoft REST API Guidelines.
AL0136 DoNotWriteCodeThatWillNeverBeHit Do not write code that will never be hit.
AL0175 DoNotFindRecordAndNotUse Only find or get records if you are not using values.
AL0074 TextConstLabelVariableNamesShouldHaveApprovedSuffix TextConst and Label variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage.
AL0106 ApiPageCanOnlyReferToTheSameSubpageOnce A page of type API can only refer to the same subpage once.
AL0201 ApplicationAreaBasicAndSuite When ApplicationArea is set to ‘Basic’, you must also specify ‘Suite’.
AL0131 StringParamsMustMatchPlaceholdersMessageFormat The number of parameters passed to a string must match the placeholders.
AL0198 GlobalLocalVariablesShouldNotHaveSameName Do not use identical names for local and global variables.
AL0210 SuboptimalIndex Suboptimal index.
AL0137 DoNotDeclareVariablesThatAreUnused Do not declare variables that are unused.
AL0040 DoNotNestWithsMessageFormat This WITH statement is nested inside another WITH statement at ‘{0}’.
AL0018 KeywordShouldBeFirstOnLineMessageFormat The ‘{0}’ keyword should always start a line.
AL0101 UseCamelCasePropertyValuesForApiPages Use camel case property values in pages of type API.
AL0103 UseCamelCasePropertyValuesForApiQueries 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.
AL0100 DoNotHaveIdentifiersWithQuotesInTheName Do not have identifiers with quotes in the name.
AL0021 VariableDeclarationsShouldBeOrderedByTypeMessageFormat 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.
AL0137 DoNotDeclareVariablesThatAreUnused Do not declare variables that are unused.
AL0204 DoNotNameGlobalVarAsFieldOrMethod To avoid confusion, do not give global variables the same name as fields, methods or actions in the same scope.
AL0194 DoNotWriteActionsWithNoEffect Only write actions that have an effect.
AL0005 OnlyUseBeginEndForCompoundStatementsMessageFormat Only use BEGIN..END to enclose compound statements.
AL0022 SubstituteIfElseWithCaseStatementIfMoreThanTwoAlternatives An IF followed by two or more ELSE IF should be replaced with a CASE.
AL0105 PagePartMustNotReferToParentPage PagePart controls must not refer to parent pages.
AL0204 DoNotNameGlobalVarAsFieldOrMethod To avoid confusion, do not give global variables the same name as fields, methods or actions in the same scope.
AL0104 UseCamelCaseColumnNamesForApiQueriesMessageFormat Column controls in queries of type API should have a camel case name.
AL0022 SubstituteIfElseWithCaseStatementIfMoreThanTwoAlternativesMessageFormat Substitute the IF THEN ELSE structure with a CASE.
AL0199 ApplicationAreaIncorrectOrderMessageFormat Value ‘{0}’ found on control {1} {2}. Incorrect order, expected order is: {3}.
AL0105 PagePartMustNotReferToParentPage PagePart controls must not refer to parent pages.
AL0202 DoNotNameLocalVarAsFieldOrMethod To avoid confusion, do not give local variables the same name as fields, methods or actions in the same scope.
AL0139 DoNotAssignToStringWithSmallerCapacity Do not assign a textto a target with smaller size.
AL0462 CalcDateOnlyWithDateFormulaUsage The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the < > symbols.
AL0137 DoNotDeclareVariablesThatAreUnusedMessageFormat Variable ‘{0}’ is unused in ‘{1}’.
AL0210 SuboptimalIndexMessageFormat The table {0} does not contain the key with the field {1}.
AL0008 UseParenthesisForFunctionCall Use parenthesis in a function call even if the function does not have any parameters.
AL0100 DoNotHaveIdentifiersWithQuotesInTheName Do not have identifiers with quotes in the name.
AL0106 ApiPageCanOnlyReferToTheSameSubpageOnce A page of type API can only refer to the same subpage once.
AL0200 ApplicationAreaAllShouldBeAlone ‘All’ should always stand alone has incorrect order.
AL0002 UnaryOperatorNoSpacingMessageFormat There must be no space character after ‘{0}’.
AL0194 DoNotWriteActionsWithNoEffect Remember to specify either the ‘OnAction’ trigger or ‘RunObject’ property on an action.
AL0204 DoNotNameGlobalVarAsFieldOrMethodMessageFormat The name of the global variable ‘{0}’ is identical to a field, method or action in the same scope.
AL0198 GlobalLocalVariablesShouldNotHaveSameNameMessageFormat The name of the local variable ‘{0}’ is identical to a global variable.
AL0100 DoNotHaveIdentifiersWithQuotesInTheNameMessageFormat Do not have identifiers with quotes in the name.

1 thought on “All the CodeCop Rules

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.