From afc1d64ad65097d16506bc02579cdb73818743cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Br=C3=A4unlich?= Date: Fri, 15 Apr 2022 12:59:51 +0000 Subject: [PATCH] updated blank lines --- .../blank-lines-when-not-to-use/index.md | 53 ----------- .../docs/BestPractices/blank-lines/index.md | 87 ++++--------------- 2 files changed, 18 insertions(+), 122 deletions(-) delete mode 100644 content/docs/BestPractices/blank-lines-when-not-to-use/index.md diff --git a/content/docs/BestPractices/blank-lines-when-not-to-use/index.md b/content/docs/BestPractices/blank-lines-when-not-to-use/index.md deleted file mode 100644 index 3c9c5439..00000000 --- a/content/docs/BestPractices/blank-lines-when-not-to-use/index.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "When not to use Blank Lines" -tags: ["AL","Readability"] -categories: ["Best Practice"] ---- - -Do not use blank lines: - -- at the beginning or end of any functions (after `begin` and before `end`) -- inside multiline expressions - -## Example 1 - -### Bad code - -```al -procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); -begin - - SetupDrillDownCol(MATRIX_ColumnOrdinal); - DrillDown(false, ValueType); - -end; -``` - -### Good code - -```al -procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); -begin - SetupDrillDownCol(MATRIX_ColumnOrdinal); - DrillDown(false, ValueType); -end; -``` - -## Example 2 - -### Bad code - -```al -if NameIsValid and - - Name2IsValid -then -``` - -### Good code - -```al -if NameIsValid and - Name2IsValid -then -``` diff --git a/content/docs/BestPractices/blank-lines/index.md b/content/docs/BestPractices/blank-lines/index.md index 273882d7..1f53db34 100644 --- a/content/docs/BestPractices/blank-lines/index.md +++ b/content/docs/BestPractices/blank-lines/index.md @@ -1,48 +1,38 @@ --- -title: "Avoid too many blank lines" +title: "When not to use Blank Lines" tags: ["AL","Readability"] categories: ["Best Practice"] --- ## Description -Avoid too many blank lines. +Do not use blank lines: + +- at the beginning or end of any functions (after `begin` and before `end`) +- inside multiline expression +- after blank lines ## Example 1 ### Bad code ```al -var - UserSetup: Record "User Setup"; - IsEditable: Boolean; - IsVisible: Boolean; - - -local procedure Initialize() +procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); begin - IsEditable := false; - IsVisible := false; + SetupDrillDownCol(MATRIX_ColumnOrdinal); + DrillDown(false, ValueType); - UserSetup.Get(); end; ``` ### Good code ```al -var - UserSetup: Record "User Setup"; - IsEditable: Boolean; - IsVisible: Boolean; - -local procedure Initialize() +procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer); begin - IsEditable := false; - IsVisible := false; - - UserSetup.Get(); + SetupDrillDownCol(MATRIX_ColumnOrdinal); + DrillDown(false, ValueType); end; ``` @@ -51,59 +41,18 @@ end; ### Bad code ```al -page 50000 "Blank Lines" -{ - PageType = List; - ApplicationArea = All; - UsageCategory = Administration; - SourceTable = Customer; +if NameIsValid and - - layout - { - area(Content) - { - repeater(GroupName) - { - ShowCaption = false; - - - field(Name; Rec.Name) - { - ApplicationArea = All; - } - } - } - } -} + Name2IsValid +then ``` ### Good code ```al -page 50000 "Blank Lines" -{ - PageType = List; - ApplicationArea = All; - UsageCategory = Administration; - SourceTable = Customer; - - layout - { - area(Content) - { - repeater(GroupName) - { - ShowCaption = false; - - field(Name; Rec.Name) - { - ApplicationArea = All; - } - } - } - } -} +if NameIsValid and + Name2IsValid +then ``` ## Example 3