Merge pull request #68 from microsoft/waldo/NewGuidelines
Moved guidelines.. .
This commit is contained in:
commit
da9359cdb0
4 changed files with 107 additions and 8 deletions
|
|
@ -0,0 +1,33 @@
|
|||
+++
|
||||
title = "begin as an 'After Word'"
|
||||
weight = 230
|
||||
+++
|
||||
|
||||
<_Created by Microsoft, Described by waldo_\>
|
||||
|
||||
## Description
|
||||
|
||||
When `begin` follows `then`, `else`, `do`, it should be on the same line, preceded by one space character.
|
||||
|
||||
## Bad code
|
||||
|
||||
```al
|
||||
if ICPartnerRefType = ICPartnerRefType::"Common Item No." then
|
||||
begin
|
||||
...
|
||||
end;
|
||||
```
|
||||
|
||||
## Good code
|
||||
|
||||
```al
|
||||
if ICPartnerRefType = ICPartnerRefType::"Common Item No." then begin
|
||||
...
|
||||
end;
|
||||
```
|
||||
|
||||
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=begin+as+an+After+Word+category%3A%22BC+Best+Practices%22)
|
||||
|
||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
||||
|
||||
If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article.
|
||||
59
content/BCBestPractices/Readability/begin-end/index.md
Normal file
59
content/BCBestPractices/Readability/begin-end/index.md
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
+++
|
||||
title = "Begin-End - Compound Only"
|
||||
weight = 240
|
||||
+++
|
||||
|
||||
<_Created by Microsoft, Described by waldo_\>
|
||||
|
||||
Only use begin..end to enclose [compound statements](https://docs.microsoft.com/en-us/cpp/c-language/compound-statement-c?view=msvc-170#:~:text=A%20compound%20statement%20%28also%20called%20a%20%22block%22%29%20typically,appear%20at%20the%20head%20of%20a%20compound%20statement.).
|
||||
|
||||
## Bad code
|
||||
|
||||
```AL
|
||||
if FindSet() then begin
|
||||
repeat
|
||||
...
|
||||
until next() = 0;
|
||||
end;
|
||||
```
|
||||
|
||||
## Good code
|
||||
|
||||
```AL
|
||||
IF FindSet() then
|
||||
repeat
|
||||
...
|
||||
until next() = 0;
|
||||
```
|
||||
|
||||
## Bad code
|
||||
|
||||
```AL
|
||||
IF IsAssemblyOutputLine then begin
|
||||
TestField("Order Line No.",0);
|
||||
end;
|
||||
```
|
||||
|
||||
## Good code
|
||||
|
||||
```AL
|
||||
IF IsAssemblyOutputLine then
|
||||
TestField("Order Line No.",0);
|
||||
```
|
||||
|
||||
## Exception
|
||||
|
||||
```AL
|
||||
// Except for this case
|
||||
IF X then begin
|
||||
IF Y then
|
||||
//DO SOMETHING;
|
||||
end else
|
||||
(not X)
|
||||
```
|
||||
|
||||
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=begin+end+compound+only+category%3A%22BC+Best+Practices%22)
|
||||
|
||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
||||
|
||||
If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article.
|
||||
|
|
@ -6,10 +6,6 @@ This is a guideline, some parts are optional (if there's no content, remove the
|
|||
|
||||
<_Created by (company), Described by (company)_\>
|
||||
|
||||
## Abstract
|
||||
|
||||
Short, descriptive and easy to remember description of this pattern.
|
||||
|
||||
## Description
|
||||
|
||||
In depth description on what this Pattern is all about
|
||||
|
|
@ -18,12 +14,23 @@ In depth description on what this Pattern is all about
|
|||
- steps to implement
|
||||
- considerations to take
|
||||
|
||||
## Good Example
|
||||
|
||||
## Bad code
|
||||
|
||||
```al
|
||||
PutCodeblocksHere()
|
||||
```
|
||||
|
||||
## Bad Example
|
||||
## Good code
|
||||
|
||||
```al
|
||||
PutCodeblocksHere()
|
||||
```
|
||||
|
||||
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=TITLEOFYOURGUIDELINEGOESHERE+category%3A%22BC+Best+Practices%22)
|
||||
|
||||
<Please replace the "TITLEOFYOURGUIDELINEGOESHERE" in the link above, with the Title+of+the+Guideline (indeed, with "space" replaced by a "+") - and remove this line. \>
|
||||
|
||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
||||
|
||||
If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article.
|
||||
Loading…
Add table
Add a link
Reference in a new issue