Merge pull request #89 from StefanMaron/main
Cosmetic changes to the readability pages
This commit is contained in:
commit
0652b72824
8 changed files with 35 additions and 34 deletions
|
|
@ -20,7 +20,7 @@ end;
|
||||||
## Good code
|
## Good code
|
||||||
|
|
||||||
```AL
|
```AL
|
||||||
IF FindSet() then
|
if FindSet() then
|
||||||
repeat
|
repeat
|
||||||
...
|
...
|
||||||
until next() = 0;
|
until next() = 0;
|
||||||
|
|
@ -29,24 +29,24 @@ IF FindSet() then
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```AL
|
```AL
|
||||||
IF IsAssemblyOutputLine then begin
|
if IsAssemblyOutputLine then begin
|
||||||
TestField("Order Line No.",0);
|
TestField("Order Line No.", 0);
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Good code
|
## Good code
|
||||||
|
|
||||||
```AL
|
```AL
|
||||||
IF IsAssemblyOutputLine then
|
if IsAssemblyOutputLine then
|
||||||
TestField("Order Line No.",0);
|
TestField("Order Line No.", 0);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Exception
|
## Exception
|
||||||
|
|
||||||
```AL
|
```AL
|
||||||
// Except for this case
|
// Except for this case
|
||||||
IF X then begin
|
if X then begin
|
||||||
IF Y then
|
if Y then
|
||||||
//DO SOMETHING;
|
//DO SOMETHING;
|
||||||
end else
|
end else
|
||||||
(not X)
|
(not X)
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ The `end else` pair should always appear on the same line.
|
||||||
...
|
...
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
...
|
...
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
@ -27,7 +28,7 @@ The `end else` pair should always appear on the same line.
|
||||||
if OppEntry.Find('-') then
|
if OppEntry.Find('-') then
|
||||||
if SalesCycleStage.Find('-') then begin
|
if SalesCycleStage.Find('-') then begin
|
||||||
...
|
...
|
||||||
end else
|
end else begin
|
||||||
...
|
...
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
@ -36,4 +37,4 @@ The `end else` pair should always appear on the same line.
|
||||||
|
|
||||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,17 @@ When calling an object statically use the Object Name, not the Object Id.
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
Page.RunModal(525,SalesShptLine)
|
Page.RunModal(525, SalesShptLine);
|
||||||
```
|
```
|
||||||
|
|
||||||
## Good code
|
## Good code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
Page.RunModal(Page::"Posted Sales Shipment Lines",SalesShptLine)
|
Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine);
|
||||||
```
|
```
|
||||||
|
|
||||||
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=named+invocations+category%3A%22BC+Best+Practices%22)
|
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=named+invocations+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).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ A line of code should not have more than one statement.
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
if OppEntry.Find('-') then exit();
|
if OppEntry.Find('-') then exit;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ A line of code should not have more than one statement.
|
||||||
|
|
||||||
```al
|
```al
|
||||||
if OppEntry.Find('-') then
|
if OppEntry.Find('-') then
|
||||||
exit();
|
exit;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
@ -40,4 +40,4 @@ A line of code should not have more than one statement.
|
||||||
|
|
||||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ weight = 1050
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
if Atom = '\>' then HasLogicalOperator := TRUE else begin
|
if Atom = '\>' then HasLogicalOperator := true else begin
|
||||||
...
|
...
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
@ -31,4 +31,4 @@ weight = 1050
|
||||||
|
|
||||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,10 @@ weight = 1270
|
||||||
```al
|
```al
|
||||||
procedure SomeProcedure()
|
procedure SomeProcedure()
|
||||||
begin
|
begin
|
||||||
if IsAdjmtBinCodeChanged then
|
if IsAdjmtBinCodeChanged() then
|
||||||
Error(AdjmtBinCodeChangeNotAllowedErr,...)
|
Error(AdjmtBinCodeChangeNotAllowedErr, ...)
|
||||||
else
|
else
|
||||||
Error(BinCodeChangeNotAllowedErr,...);
|
Error(BinCodeChangeNotAllowedErr, ...);
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -24,9 +24,9 @@ weight = 1270
|
||||||
```al
|
```al
|
||||||
procedure SomeProcedure()
|
procedure SomeProcedure()
|
||||||
begin
|
begin
|
||||||
if IsAdjmtBinCodeChanged then
|
if IsAdjmtBinCodeChanged() then
|
||||||
Error(AdjmtBinCodeChangeNotAllowedErr,...)
|
Error(AdjmtBinCodeChangeNotAllowedErr, ...)
|
||||||
Error(BinCodeChangeNotAllowedErr,...);
|
Error(BinCodeChangeNotAllowedErr, ...);
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -35,4 +35,4 @@ weight = 1270
|
||||||
|
|
||||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -17,19 +17,19 @@ If a variable is a compound of two or more words or abbreviations, each word or
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
WIPBuffer : Record "Job WIP Buffer"
|
WIPBuffer: Record "Job WIP Buffer"
|
||||||
```
|
```
|
||||||
## Good code
|
## Good code
|
||||||
```al
|
```al
|
||||||
JobWIPBuffer : Record "Job WIP Buffer"
|
JobWIPBuffer: Record "Job WIP Buffer"
|
||||||
```
|
```
|
||||||
## Bad code
|
## Bad code
|
||||||
```al
|
```al
|
||||||
Postline : Codeunit "Gen. Jnl.-Post Line";
|
Postline: Codeunit "Gen. Jnl.-Post Line";
|
||||||
```
|
```
|
||||||
## Good code
|
## Good code
|
||||||
```al
|
```al
|
||||||
GenJnlPostLine : Codeunit "Gen. Jnl.-Post Line";
|
GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line";
|
||||||
```
|
```
|
||||||
## Bad code
|
## Bad code
|
||||||
```al
|
```al
|
||||||
|
|
@ -44,4 +44,4 @@ If a variable is a compound of two or more words or abbreviations, each word or
|
||||||
|
|
||||||
You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices).
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -28,19 +28,19 @@ Variables declarations should be ordered by type. In general, object and complex
|
||||||
## Bad code
|
## Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
StartingDateFilter : Text;
|
StartingDateFilter: Text;
|
||||||
Vendor : Record Vendor;
|
Vendor: Record Vendor;
|
||||||
```
|
```
|
||||||
|
|
||||||
## Good code
|
## Good code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
Vendor : Record Vendor;
|
Vendor: Record Vendor;
|
||||||
StartingDateFilter : Text;
|
StartingDateFilter: Text;
|
||||||
```
|
```
|
||||||
|
|
||||||
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variables+declarations+order+category%3A%22BC+Best+Practices%22)
|
## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variables+declarations+order+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).
|
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.
|
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