From ccdaa1e08ef8430d22a388a28eb5fadaffc4aeb3 Mon Sep 17 00:00:00 2001 From: christianbraeunlich Date: Sat, 26 Mar 2022 09:01:43 +0100 Subject: [PATCH] updated to darker color --- content/docs/BestPractices/DeleteAll/index.md | 4 ++-- .../docs/BestPractices/SubscriberCodeunits/index.md | 12 ++++++------ .../BestPractices/begin-as-an-afterword/index.md | 2 +- content/docs/BestPractices/begin-end/index.md | 8 ++++---- .../binary-operator-line-start/index.md | 4 ++-- content/docs/BestPractices/case-actions/index.md | 4 ++-- content/docs/BestPractices/comments-spacing/index.md | 4 ++-- content/docs/BestPractices/end-else-pair/index.md | 4 ++-- .../BestPractices/keyword-pairs-indentation/index.md | 4 ++-- .../docs/BestPractices/line-start-keywords/index.md | 4 ++-- content/docs/BestPractices/lonely-repeat/index.md | 4 ++-- .../docs/BestPractices/named-invocations/index.md | 4 ++-- .../BestPractices/one-statement-per-line/index.md | 8 ++++---- .../docs/BestPractices/separate-if-and-else/index.md | 4 ++-- .../BestPractices/spacing-binary-operators/index.md | 12 ++++++------ content/docs/BestPractices/unnecessary-else/index.md | 4 ++-- .../BestPractices/unnecessary-truefalse/index.md | 8 ++++---- content/docs/BestPractices/variable-naming/index.md | 12 ++++++------ .../variables-declarations-order/index.md | 4 ++-- .../Contributing/Templates/BestPractice/index.md | 4 ++-- 20 files changed, 57 insertions(+), 57 deletions(-) diff --git a/content/docs/BestPractices/DeleteAll/index.md b/content/docs/BestPractices/DeleteAll/index.md index 2643bee8..384b31bf 100644 --- a/content/docs/BestPractices/DeleteAll/index.md +++ b/content/docs/BestPractices/DeleteAll/index.md @@ -11,14 +11,14 @@ _Created by waldo, Described by waldo_ When you perform a "DeleteAll" when there is nothing to delete, it will still perform a lock. When you for example perform a DeleteAll on an empty table, it will result in a table lock. Therefore it's good practice to always check if the table is empty when performing a DeleteAll. -## Bad code +## Bad code ```al EmptyTableWLD.SetRange(Code, 'AJ'); EmptyTableWLD.DeleteAll(true); ``` -## Good code +## Good code ```al EmptyTableWLD.SetRange(Code, 'AJ'); diff --git a/content/docs/BestPractices/SubscriberCodeunits/index.md b/content/docs/BestPractices/SubscriberCodeunits/index.md index f14869f7..9b7d937a 100644 --- a/content/docs/BestPractices/SubscriberCodeunits/index.md +++ b/content/docs/BestPractices/SubscriberCodeunits/index.md @@ -28,7 +28,7 @@ Examples: - if you app does things on Sales and Purchase, create a Sales-subs codeunit, and a Purchase-subs. - if you have multiple functionalities in your app (let's call'm modules), create a subs-codeunit per module, and only add the subscribers in there that are necessary for that module. -### Bad code +### Bad code ```AL codeunit 2037325 "Setup Subs" @@ -77,7 +77,7 @@ codeunit 2037325 "Setup Subs" } ``` -### Good code +### Good code Split into 2 codeunits, and move the business logic out. @@ -115,7 +115,7 @@ codeunit 2037324 "RHE Setup Subs" To avoid the extra "loading of the content" while a subscriber is being executed, use Single Instance codeunit for subscribers. Do take into account, of course, that it would share the state across the entire session. -### Bad code +### Bad code ```AL codeunit 2037324 "RHE Setup Subs" @@ -130,7 +130,7 @@ codeunit 2037324 "RHE Setup Subs" } ``` -### Good code +### Good code ```AL codeunit 2037324 "RHE Setup Subs" @@ -151,7 +151,7 @@ codeunit 2037324 "RHE Setup Subs" If possible, only execute the subscriber when really necessary by using Manual Binding. -### Bad code +### Bad code ```AL //subscriber - code should actually only run when Color=Red. @@ -171,7 +171,7 @@ If possible, only execute the subscriber when really necessary by using Manual B until JustSomeTable.Next() < 1; ``` -### Good code +### Good code ```AL if JustSomeTable.FindSet() then diff --git a/content/docs/BestPractices/begin-as-an-afterword/index.md b/content/docs/BestPractices/begin-as-an-afterword/index.md index 5043e244..a1307715 100644 --- a/content/docs/BestPractices/begin-as-an-afterword/index.md +++ b/content/docs/BestPractices/begin-as-an-afterword/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ When `begin` follows `then`, `else`, `do`, it should be on the same line, preceded by one space character. -## Bad code +## Bad code ```al if ICPartnerRefType = ICPartnerRefType::"Common Item No." then diff --git a/content/docs/BestPractices/begin-end/index.md b/content/docs/BestPractices/begin-end/index.md index c6017c52..fe237200 100644 --- a/content/docs/BestPractices/begin-end/index.md +++ b/content/docs/BestPractices/begin-end/index.md @@ -8,7 +8,7 @@ _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 +## Bad code ```AL if FindSet() then begin @@ -18,7 +18,7 @@ if FindSet() then begin end; ``` -## Good code +## Good code ```AL if FindSet() then @@ -27,7 +27,7 @@ if FindSet() then until next() = 0; ``` -## Bad code +## Bad code ```AL if IsAssemblyOutputLine then begin @@ -35,7 +35,7 @@ if IsAssemblyOutputLine then begin end; ``` -## Good code +## Good code ```AL if IsAssemblyOutputLine then diff --git a/content/docs/BestPractices/binary-operator-line-start/index.md b/content/docs/BestPractices/binary-operator-line-start/index.md index 0ed5957d..f8e339c4 100644 --- a/content/docs/BestPractices/binary-operator-line-start/index.md +++ b/content/docs/BestPractices/binary-operator-line-start/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ Do not start a line with a binary operator. -## Bad code +## Bad code ```AL "Quantity to Ship" := @@ -18,7 +18,7 @@ Quantity - "Quantity Shipped" ``` -## Good code +## Good code ```AL "Quantity to Ship" := diff --git a/content/docs/BestPractices/case-actions/index.md b/content/docs/BestPractices/case-actions/index.md index 3aab5f5e..9b2ae427 100644 --- a/content/docs/BestPractices/case-actions/index.md +++ b/content/docs/BestPractices/case-actions/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ A CASE action should start on a line after the possibility. -## Bad code +## Bad code ```AL case Letter of @@ -19,7 +19,7 @@ A CASE action should start on a line after the possibility. end; ``` -## Good code +## Good code ```AL case Letter of diff --git a/content/docs/BestPractices/comments-spacing/index.md b/content/docs/BestPractices/comments-spacing/index.md index 3d33ccec..10da7800 100644 --- a/content/docs/BestPractices/comments-spacing/index.md +++ b/content/docs/BestPractices/comments-spacing/index.md @@ -10,13 +10,13 @@ _Created by Microsoft, Described by waldo_ Always start comments with // followed by one space character. -## Bad code +## Bad code ```al RowNo += 1000; //Move way below the budget ``` -## Good code +## Good code ```al RowNo += 1000; // Move way below the budget diff --git a/content/docs/BestPractices/end-else-pair/index.md b/content/docs/BestPractices/end-else-pair/index.md index 9fc2699b..0255a9db 100644 --- a/content/docs/BestPractices/end-else-pair/index.md +++ b/content/docs/BestPractices/end-else-pair/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ The `end else` pair should always appear on the same line. -## Bad code +## Bad code ```al if OppEntry.Find('-') then @@ -23,7 +23,7 @@ The `end else` pair should always appear on the same line. end; ``` -## Good code +## Good code ```al if OppEntry.Find('-') then diff --git a/content/docs/BestPractices/keyword-pairs-indentation/index.md b/content/docs/BestPractices/keyword-pairs-indentation/index.md index 9f1b5698..fad46b97 100644 --- a/content/docs/BestPractices/keyword-pairs-indentation/index.md +++ b/content/docs/BestPractices/keyword-pairs-indentation/index.md @@ -10,14 +10,14 @@ _Created by Microsoft, Described by waldo_ The `if..then` pair, `while..do` pair, and `for..do` pair must appear on the same line or the same level of indentation. If possible, you can align the lines it is even much more readable. -## Bad code +## Bad code ```al if (x = y) and (a = b) then ``` -## Good code +## Good code ```al if (x = y) and diff --git a/content/docs/BestPractices/line-start-keywords/index.md b/content/docs/BestPractices/line-start-keywords/index.md index 119a2d5a..fca6a3d9 100644 --- a/content/docs/BestPractices/line-start-keywords/index.md +++ b/content/docs/BestPractices/line-start-keywords/index.md @@ -9,7 +9,7 @@ _Created by Microsoft, Described by waldo_ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should always start a line. -## Bad code +## Bad code ```al if IsContactName then ValidateContactName() @@ -17,7 +17,7 @@ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should al else if IsSalesCycleCode then ValidatSalesCycleCode(); ``` -## Good code +## Good code ```al if IsContactName then diff --git a/content/docs/BestPractices/lonely-repeat/index.md b/content/docs/BestPractices/lonely-repeat/index.md index de2165cc..10072151 100644 --- a/content/docs/BestPractices/lonely-repeat/index.md +++ b/content/docs/BestPractices/lonely-repeat/index.md @@ -10,13 +10,13 @@ _Created by Microsoft, Described by waldo_ The `repeat` statement should always be alone on a line. -## Bad code +## Bad code ```al if ReservEntry.FindSet() then repeat ``` -## Good code +## Good code ```al if ReservEntry.FindSet() then diff --git a/content/docs/BestPractices/named-invocations/index.md b/content/docs/BestPractices/named-invocations/index.md index 2811c18f..c55b74ae 100644 --- a/content/docs/BestPractices/named-invocations/index.md +++ b/content/docs/BestPractices/named-invocations/index.md @@ -10,13 +10,13 @@ _Created by Microsoft, Described by waldo_ When calling an object statically use the Object Name, not the Object Id. -## Bad code +## Bad code ```al Page.RunModal(525, SalesShptLine); ``` -## Good code +## Good code ```al Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine); diff --git a/content/docs/BestPractices/one-statement-per-line/index.md b/content/docs/BestPractices/one-statement-per-line/index.md index 67e01c15..0b171979 100644 --- a/content/docs/BestPractices/one-statement-per-line/index.md +++ b/content/docs/BestPractices/one-statement-per-line/index.md @@ -10,26 +10,26 @@ _Created by Microsoft, Described by waldo_ A line of code should not have more than one statement. -## Bad code +## Bad code ```al if OppEntry.Find('-') then exit; ``` -## Good code +## Good code ```al if OppEntry.Find('-') then exit; ``` -## Bad code +## Bad code ```al TotalCost += Cost; TotalAmt += Amt; ``` -## Good code +## Good code ```al TotalCost += Cost; diff --git a/content/docs/BestPractices/separate-if-and-else/index.md b/content/docs/BestPractices/separate-if-and-else/index.md index 2154a0ee..c312d70d 100644 --- a/content/docs/BestPractices/separate-if-and-else/index.md +++ b/content/docs/BestPractices/separate-if-and-else/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ `if` and `else` statements should be on separate lines. -## Bad code +## Bad code ```al if Atom = '\>' then HasLogicalOperator := true else begin @@ -18,7 +18,7 @@ _Created by Microsoft, Described by waldo_ end; ``` -## Good code +## Good code ```al if Atom = '\>' then diff --git a/content/docs/BestPractices/spacing-binary-operators/index.md b/content/docs/BestPractices/spacing-binary-operators/index.md index c59cb7b4..90a1d321 100644 --- a/content/docs/BestPractices/spacing-binary-operators/index.md +++ b/content/docs/BestPractices/spacing-binary-operators/index.md @@ -10,37 +10,37 @@ _Created by Microsoft, Described by waldo_ 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 a space after the comma. -## Bad code +## Bad code ```al "Line Discount %" := "Line Discount Amount"/"Line Value"*100; ``` -## Good code +## Good code ```al "Line Discount %" := "Line Discount Amount" / "Line Value" * 100; ``` -## Bad code +## Bad code ```al StartDate := CalcDate('<+'+Format(Days+i)+'D\>',StartDate); ``` -## Good code +## Good code ```al StartDate := CalcDate('<+' + Format(Days + i) + 'D\>', StartDate); ``` -## Bad code +## Bad code ```al StartDate:=0D; // Initialize ``` -## Good code +## Good code ```al StartDate := 0D; // Initialize diff --git a/content/docs/BestPractices/unnecessary-else/index.md b/content/docs/BestPractices/unnecessary-else/index.md index b85322d4..7185b104 100644 --- a/content/docs/BestPractices/unnecessary-else/index.md +++ b/content/docs/BestPractices/unnecessary-else/index.md @@ -10,7 +10,7 @@ _Created by Microsoft, Described by waldo_ `else` should not be used when the last action in the `then` part is an `exit`, `break`, `skip`, `quit`, `error`. -## Bad code +## Bad code ```al procedure SomeProcedure() @@ -22,7 +22,7 @@ _Created by Microsoft, Described by waldo_ end; ``` -## Good code +## Good code ```al procedure SomeProcedure() diff --git a/content/docs/BestPractices/unnecessary-truefalse/index.md b/content/docs/BestPractices/unnecessary-truefalse/index.md index da8fd0f8..22211233 100644 --- a/content/docs/BestPractices/unnecessary-truefalse/index.md +++ b/content/docs/BestPractices/unnecessary-truefalse/index.md @@ -9,25 +9,25 @@ _Created by Microsoft, Described by waldo_ ## Description Do not use `true` or `false` keywords unnecessarily if the expression is already an logical expression. -## Bad code +## Bad code ```al if IsPositive() = true then ``` -## Good code +## Good code ```al if IsPositive() then ``` -## Bad code +## Bad code ```al if Complete <> true then ``` -## Good code +## Good code ```al if not Complete then diff --git a/content/docs/BestPractices/variable-naming/index.md b/content/docs/BestPractices/variable-naming/index.md index 378a355d..6a80cc48 100644 --- a/content/docs/BestPractices/variable-naming/index.md +++ b/content/docs/BestPractices/variable-naming/index.md @@ -16,37 +16,37 @@ Blanks, periods, and other characters (such as parentheses) that would make quot If a variable is a compound of two or more words or abbreviations, each word or abbreviation should begin with a capital letter. -## Bad code +## Bad code ```al WIPBuffer: Record "Job WIP Buffer" ``` -## Good code +## Good code ```al JobWIPBuffer: Record "Job WIP Buffer" ``` -## Bad code +## Bad code ```al Postline: Codeunit "Gen. Jnl.-Post Line"; ``` -## Good code +## Good code ```al GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; ``` -## Bad code +## Bad code ```al "Amount (LCY)": Decimal; ``` -## Good code +## Good code ```al AmountLCY: Decimal; diff --git a/content/docs/BestPractices/variables-declarations-order/index.md b/content/docs/BestPractices/variables-declarations-order/index.md index 66d733bf..8e8f0d94 100644 --- a/content/docs/BestPractices/variables-declarations-order/index.md +++ b/content/docs/BestPractices/variables-declarations-order/index.md @@ -26,14 +26,14 @@ Variables declarations should be ordered by type. In general, object and complex (Ref: [Microsoft Docs](https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/analyzers/codecop-aa0021)) -## Bad code +## Bad code ```al StartingDateFilter: Text; Vendor: Record Vendor; ``` -## Good code +## Good code ```al Vendor: Record Vendor; diff --git a/content/docs/Contributing/Templates/BestPractice/index.md b/content/docs/Contributing/Templates/BestPractice/index.md index fc41ed3f..6cd1e4d9 100644 --- a/content/docs/Contributing/Templates/BestPractice/index.md +++ b/content/docs/Contributing/Templates/BestPractice/index.md @@ -18,13 +18,13 @@ In depth description on what this Pattern is all about - steps to implement - considerations to take -## Bad code +## Bad code ```al PutCodeblocksHere() ``` -## Good code +## Good code ```al PutCodeblocksHere()