We’re the Dynamics
NAV developers. We can develop modules, functionalities, fix bugs all the live
long day, but, is our code adhere Coding Guidelines, as per Microsoft up there?
That’s the end game. How were you guys planning on beating that?
Followings
are the catalog of coding violations in 4 major categories or Rules, Readability,
Design, Globalization & User eXperience.
// Readability Rules |
// Rules which ensure that the code is well-formatted and readable. |
Error001 = "Readability: 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."; |
Error002 = "Readability: There must be no space between a unary operator and its argument (except for the NOT keyword)."; |
Error003 = "Readability: There must be no spaces characters before and after [] dimension brackets symbols or :: option symbols."; |
Error004 = "Readability: Do not use blank lines at the beginning or end of any functions, after BEGIN, before END, or inside multiline expressions."; |
Error005 = "Readability: Only use BEGIN..END to enclose compound statements."; |
Error008 = "Readability: Do not use parenthesis in a function call if the function does not have any parameters."; |
Error009 = "Readability: Use parenthesis only to enclose compound expressions inside compound expressions."; |
Error010 = "Readability: Never use curly bracket comments."; |
Error011 = "Readability: Always start comments with // followed by one space character."; |
Error012 = "Readability: In general, use an indentation of two space characters. Logical expressions in the IF, WHILE, and UNTIL parts are indented at least 3, 6, and 6 spaces respectively."; |
Error013 = "Readability: When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character."; |
Error015 = "Readability: A CASE action should start on a line after the possibility."; |
Error016 = "Readability: IF and ELSE statements should be on separate lines."; |
Error017 = "Readability: The REPEAT statement should always be alone on a line."; |
Error018 = "Readability: The END, IF, REPEAT, FOR, WHILE, and CASE statement should always start a line."; |
Error020 = "Readability: The last possibility on a CASE statement must be immediately followed by a colon."; |
Error021 = "Readability: Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables"; |
Error022 = "Readability: Substitute the indented IF THEN ELSE structure with a CASE if there are more than two alternatives."; |
Error023 = "Readability: The IF..THEN pair, WHILE..DO pair, and FOR..DO pair must appear on the same line or the same level of indentation."; |
Error024 = "Readability: The END ELSE pair should always appear on the same line."; |
Error025 = "Readability: A line of code should not have more than one statement."; |
Error035 = "Readability: ELSE should not be used when the last action in the THEN part is an EXIT,BREAK,SKIP,QUIT,ERROR."; |
Error040 = "Readability: Do not nest WITHs that reference different types of objects."; |
Error042 = "Readability: Blanks,periods and other characters that would require quotation marks around a variable must be omitted."; |
Error043 = "Readability: Do not use scope ''.'' qualifier unnecessarily when a variable is already implicitly or explicity scoped."; |
Error050 = "Readability: A line of code should not exceed 132 characters."; |
Error051 = "Readability: There should be no unnecessary empty statements."; |
Error071 = "Readability: Variable must be abbreviated correctly"; |
Error072 = "Readability: Variables that refer to a C/AL object must contain the objects name, abbreviated where necessary."; |
Error073 = "Readability: The name of a temporary variable must be prefixed with the word Temp and not otherwise."; |
Error074 = "Readability: TextConst variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage."; |
Error052 = "Readability: Do not start a line with a binary operator."; |
Error053 = "Readability: Do not end a line with unary operator."; |
Error058 = "Readability: SKIP, BREAK, and QUIT methods should always be placed directly in triggers, never in PROCEDURES"; |
Error083 = "Readability: Documentation trigger must be empty."; |
Error084 = "Readability: Do not use ChangeLog tags in code."; |
Error085 = "Readability: Do not use TRUE or FALSE keywords unnecessarily if the expression is already an logical expression."; |
Error086 = "Readability: When calling an object statically use the name, not the number"; |
// Design Rules |
// Rules that support proper design |
Error131 = "Design: The number of parameters passed to a string must match the placeholders."; |
Error136 = "Design: Do not write code that will never be hit."; |
Error137 = "Design: Do not declare variables that are unused."; |
Error138 = "Design: Do not filter using a sequence that does not have a defined index."; |
Error139 = "Design: Do assign a value to a variable whose capacity is smaller."; |
Error140 = "Design: Do assign a value to a parameter variable whose capacity is smaller."; |
Error144 = "Design: Do not use the WITH scope when it has a variable whose name is the same as a local variable. This makes the code confusing."; |
Error147 = "Design: The option values of a parameter variable must match the caller variable option values."; |
Error148 = "Design: The option values of a parameter variable must match the caller variable option values including case and spaces."; |
Error149 = "Design: The value assigned to a variable must be used."; |
Error143 = "Design: Call objects statically whenever possible."; |
Error150 = "Design: Do not declare parameters by reference if their values are never changed."; |
Error151 = "Design: Variables should always be initialised."; |
Error154 = "Design: Refactor"; |
Error155 = "Design: Size Length - LANG - {0} - exceeded by {1} on {2}."; |
Error156 = "Design: MaxLength."; |
Error159 = "Design: Functions listed in a HandlerFunction attribute should be declared and marked as handler functions"; |
Error160 = "Design: The correct OnLookup trigger code pattern must be used"; |
Error157 = "Design: Sizelength exceeded by {0} on {1}."; |
Error170 = "Design: Type conversion conflict"; |
Error174 = "Design: Only use IDs that are in the permitted range for W1 development"; |
Error175 = "Design: Only use IDs that are in the permitted range for country development"; |
Error177 = "Design: Maintainability Index: Do not write functions that have a very low maintainability index. This makes the code hard to maintain."; |
Error178 = "Design: Lines of Code: Do not write functions that have too many lines of code. This makes the code hard to maintain."; |
Error179 = "Design: Coupling: Do not write functions that have high class coupling. This makes the code hard to maintain."; |
Error180 = "Design: Do not write functions that have high cyclomatic complexity. This makes the code hard to maintain."; |
Error181 = "Design: FINDSET, FIND('+') or FIND('-') should only be used when NEXT is used and vice versa."; |
Error182 = "Design: Only approved DotNet types should be used W1 development."; |
Error186 = "Design: Declare normal procedures in Test Codeunits as local"; |
Error187 = "Design: Do not use obsolete data types for W1 development"; |
// Globalization Rules |
// Rules that support world-ready code. |
Error432 = "Localizability: Pass user messages using TextConstants."; |
Error433 = "Localizability: Warning: STRSUBSTNO format string should be TextConstant if the format string contains text."; |
Error434 = "Localizability: Warning: STRSUBSTNO format string should be TextConstant even if the format string doesn't contain text."; |
Error441 = "Localizability: Declare Text Constant as global variables."; |
Error445 = "Localizability: The OptionCaptionML must be filled in for sourceexpression using option data types."; |
Error447 = "Localizability: Option buttons must have the OptionValue filled in."; |
Error446 = "Localizability: All elements with Name property must have the CaptionML filled in."; |
Error476 = "Localizability: Warning: All controls with Name property must have the CaptionML filled in."; |
Error448 = "Localizability: For user messages,errors etc., use FIELDCAPTION not FIELDNAME and TABLECAPTION not TABLENAME."; |
Error449 = "Localizability: Warning: If STRSUBSTNO result is shown to user you need to use FIELDCAPTION not FIELDNAME (TABLECAPTION not TABLENAME) as for other user messages,errors etc.,."; |
Error450 = "Localizability: Warning: If the result of the operation is shown to user you need to use FIELDCAPTION not FIELDNAME (TABLECAPTION not TABLENAME) as for other user messages,errors etc.,."; |
Error463 = "Localizability: There should be no string concatenation in user messages, errors etc."; |
Error464 = "Localizability: There should be no string concatenation inside STRSUBSTNO"; |
Error465 = "Localizability: Warning: Strings should be formatted and not concatenated"; |
Error466 = "Localizability: Warning: Constant strings should be defined as text constants"; |
Error470 = "Localizability: If there are two or more string format place holders in a row the string should be updated or a comment should be added. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error471 = "Localizability: Text constant should always have a ENU value."; |
Error472 = "Localizability: Place holders should not be followed by text without space or other separator."; |
Error473 = "Localizability: CaptionML should not be specified on a page field for a not system table if it is exactly the same as table field name."; |
Error474 = "Localizability: CaptionML should always be specified on a page field for a system table."; |
Error475 = "Localizability: Warning: CaptionML should be specified on a page field if a filed is a variable and not a table field."; |
Error462 = "Internationalization: The CALCDATE should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols."; |
Error480 = "Localizability: If text constant contains a word in ALL CAPS a comment should be added with information how the word should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error481 = "Localizability: If text constant contains an accelerator a comment should be added with information how the accelerator should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error482 = "Localizability: If text constant contains an URI a comment should be added with information how the URI should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error483 = "Localizability: If text constant contains a html code a comment should be added with information how the html code should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error484 = "Localizability: Warning: If text constant contains a date/time format a comment should be added with information how the format should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error485 = "Localizability: If text constant contains only delimiter a comment should be added with information how the delimeter should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error486 = "Localizability: Warning: Text constant is a sentence fragment"; |
Error487 = "Localizability: If text constant contains only one letter a comment should be added with information how the letter should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error488 = "Localizability: If text constant is only one letter a comment should be added with information how the letter should be translated. More details at: http://sharepointemea/sites/DynamicsNAV/Wiki/Wiki%20Pages/Internationalization%20CAL%20guideliness.aspx"; |
Error489 = "Localizability: Text constant should not start or end with a space."; |
// User eXperience Rules |
// Rules that support proper user experience |
Error332 = "UX: Always end MESSAGE or ERROR with a period."; |
Error333 = "UX: Never use FIELDERROR with a period as it is automatically inserted."; |
Error334 = "UX: Always end CONFIRM with a question mark."; |
Error335 = "UX: A non-processing report page action must have an
image assigned to it.";Please find this sheet on How to resolve this Violations with Example. |
Thanks for sharing this impressive blog. Are you looking for the best microsoft dynamics nav support
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletew695v9pldma521 www.replicabag2023.ru w096n9ukbgs829
ReplyDelete