Added tags & categories + cleanup
This commit is contained in:
parent
4515a721bd
commit
5ee0436639
161 changed files with 295 additions and 34 deletions
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Readability"
|
||||
weight = 980
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
## C/AL Coding Guidelines
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Begin as an 'After Word'"
|
||||
weight = 230
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
When BEGIN follows THEN, ELSE, DO, it should be on the same line, preceded by one space character.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Begin-End - Compound Only"
|
||||
weight = 240
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Only use BEGIN..END to enclose compound statements.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Binary Operator to Start Line"
|
||||
weight = 250
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not start a line with a binary operator.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Blank Lines"
|
||||
weight = 260
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not use blank lines at the beginning or end of any functions, after BEGIN, before END, or inside multiline expressions.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "CASE Action"
|
||||
weight = 310
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
A CASE action should start on a line after the possibility.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Colon usage in CASE"
|
||||
weight = 340
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The last possibility on a CASE statement must be immediately followed by a colon.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Comments inside Curly Brackets"
|
||||
weight = 350
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Never use curly bracket comments. During development, the "Block comment" functionality can be used instead. However, in production code, block comments are not recommended.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Comment Spacing"
|
||||
weight = 360
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Always start comments with // followed by one space character.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "END ELSE Pair"
|
||||
weight = 540
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The END ELSE pair should always appear on the same line.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Indentation"
|
||||
weight = 650
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Keyword Pairs - Indentation"
|
||||
weight = 730
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The IF..THEN pair, WHILE..DO pair, and FOR..DO pair must appear on the same line or the same level of indentation.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Line Start Keywords"
|
||||
weight = 740
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The END, IF, REPEAT, FOR, WHILE, ELSE and CASE statement should always start a line.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Lonely Repeat"
|
||||
weight = 760
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The REPEAT statement should always be alone on a line.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Named Invocations"
|
||||
weight = 830
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
When calling an object statically use the name, not the number
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Nested WITHs"
|
||||
weight = 850
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not nest WITHs that reference different types of objects.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "One Statement Per Line"
|
||||
weight = 910
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
A line of code should not have more than one statement.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Separate IF and ELSE"
|
||||
weight = 1050
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
IF and ELSE statements should be on separate lines.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Spacing Binary Operators"
|
||||
weight = 1120
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
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.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Spacing Brackets and ::"
|
||||
weight = 1130
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
There must be no spaces characters before and after [] dimension brackets symbols or :: option symbols.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Spacing Unary Operators"
|
||||
weight = 1140
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
There must be no space between a unary operator and its argument (except for the NOT keyword).
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Suggested Abbreviations"
|
||||
weight = 1170
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
### Suggested Abbreviations
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Temporary Variable Naming"
|
||||
weight = 1200
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
The name of a temporary variable must be prefixed with the word Temp and not otherwise.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "TextConst Suffixes"
|
||||
weight = 1210
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
TextConst variable names should have a suffix (an approved three-letter suffix: Msg, Tok, Err, Qst, Lbl, Txt) describing usage.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unary Operator Line End"
|
||||
weight = 1250
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not end a line with unary operator.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unnecessary Compound Parenthesis"
|
||||
weight = 1260
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Use parenthesis only to enclose compound expressions inside compound expressions.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unnecessary ELSE"
|
||||
weight = 1270
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
ELSE should not be used when the last action in the THEN part is an EXIT, BREAK, SKIP, QUIT, ERROR.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unnecessary Function Parenthesis"
|
||||
weight = 1280
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not use parenthesis in a function call if the function does not have any parameters.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unnecessary Separators"
|
||||
weight = 1290
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
There should be no unnecessary separators.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Unnecessary TRUE/FALSE"
|
||||
weight = 1300
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not use TRUE or FALSE keywords unnecessarily if the expression is already an logical expression.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Variable Already Scoped"
|
||||
weight = 1400
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Do not use scope ''.'' qualifier unnecessarily when a variable is already implicitly or explicitly scoped. It keeps the code simpler.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Variable Naming"
|
||||
weight = 1420
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Variables that refer to a C/AL object must contain the objects name, abbreviated where necessary.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
+++
|
||||
title = "Variables Declarations Order"
|
||||
weight = 1430
|
||||
tags = ["C/AL","Readability"]
|
||||
categories = ["Best Practice"]
|
||||
+++
|
||||
Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be the same as the object list in the object designer for C/AL objects. Afterwards come the complex variables like RecordRef, .NET, FieldRef etc. At the end come all the simple data types in no particular order.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue