Skip to content

Commit

Permalink
Implementing Ruleset
Browse files Browse the repository at this point in the history
  • Loading branch information
finnpedersenkazes committed Dec 1, 2023
1 parent 66f5b33 commit dd21230
Show file tree
Hide file tree
Showing 17 changed files with 217 additions and 17 deletions.
196 changes: 196 additions & 0 deletions .vscode/AfterConversion.ruleset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"name": "After Conversion Ruleset",
"description": "This allows us to fix the issues in a prioritized order.",
"rules": [
{
"id": "AA0139",
"action": "Error",
"justification": "Do not assign a text to a target with smaller size. POTENTIAL RUNTIME ERROR."
},
{
"id": "AA0462",
"action": "Error",
"justification": "The CalcDate should only be used with DataFormula variables. Alternatively the string should be enclosed using the <> symbols. POTENTIAL RUNTIME ERROR."
},
{
"id": "AL0615",
"action": "Error",
"justification": "Field '{0}' is not specified as a source expression on page '{1}'. All fields specified in ODataKeyFields must be used as the source expression in a page control. POTENTIAL RUNTIME ERROR."
},
{
"id": "AL0254",
"action": "Error",
"justification": "Sorting field '{0}' should be part of the keys for table '{1}'. PERFORMANCE."
},
{
"id": "AA0233",
"action": "Error",
"justification": "Use Get(), FindFirst() and FindLast() without Next() method. PERFORMANCE"
},
{
"id": "AA0181",
"action": "Error",
"justification": "The FindSet() or Find() methods must be used only in connection with the Next() method. PERFORMANCE"
},
{
"id": "AA0232",
"action": "Error",
"justification": "The FlowField of a table should be indexed. PERFORMANCE. The CodeAnalyzer has a problem."
},
{
"id": "AA0210",
"action": "Error",
"justification": "Avoid non-indexed fields into filtering. PERFORMANCE"
},
{
"id": "AA0205",
"action": "Error",
"justification": "Variables must be initialized before usage. SHOULD BE INVESTIGATED. The CodeAnalyzer has a problem with TransferFields."
},
{
"id": "AA0175",
"action": "Error",
"justification": "Do not write code that will never be hit. SHOULD BE INVESTIGATED."
},
{
"id": "AA0136",
"action": "Error",
"justification": "Do not write code that will never be hit. SHOULD BE INVESTIGATED. We have one case."
},
{
"id": "AW0006",
"action": "Error",
"justification": "Pages and reports should use the UsageCategory and ApplicationArea properties to be searchable. SHOULD BE INVESTIGATED."
},
{
"id": "AA0206",
"action": "Error",
"justification": "The value assigned to a variable must be used. SHOULD BE INVESTIGATED."
},
{
"id": "AA0244",
"action": "Error",
"justification": "Do not use identical names for parameters and global variables. SHOULD BE INVESTIGATED."
},
{
"id": "AA0198",
"action": "Error",
"justification": "Do not use identical names for local and global variables. SHOULD BE INVESTIGATED."
},
{
"id": "AA0137",
"action": "Error",
"justification": "Do not declare variables that are unused. SHOULD BE INVESTIGATED."
},
{
"id": "AA0021",
"action": "Error",
"justification": "Variable declarations should be ordered by type. IMPROVE CODE READABILITY."
},
{
"id": "AA0005",
"action": "Error",
"justification": "Only use BEGIN..END to enclose compound statements. IMPROVE CODE READABILITY."
},
{
"id": "AA0228",
"action": "Error",
"justification": "The local method must be used; otherwise removed. IMPROVE CODE READABILITY."
},
{
"id": "AA0008",
"action": "Error",
"justification": "Function calls should have parenthesis even if they do not have any parameters. IMPROVE CODE READABILITY."
},
{
"id": "AA0074",
"action": "Error",
"justification": "TextConst and Label variable names should have an approved suffix. IMPROVE CODE READABILITY."
},
{
"id": "AA0215",
"action": "Error",
"justification": "Follow the style guide about the best practices for naming. IMPROVE CODE READABILITY."
},
{
"id": "AA0470",
"action": "Error",
"justification": "Placeholders should have a comment explaining their content. IMPROVE CODE READABILITY."
},
{
"id": "AA0073",
"action": "Error",
"justification": "The name of temporary variable must be prefixed with Temp. IMPROVE CODE READABILITY."
},
{
"id": "AA0202",
"action": "Error",
"justification": "To avoid confusion, do not give local variables the same name as fields, methods, or actions in the same scope. IMPROVE CODE READABILITY."
},
{
"id": "AA0241",
"action": "Error",
"justification": "Use all lowercase letters for reserved language keywords. IMPROVE CODE READABILITY."
},
{
"id": "AA0018",
"action": "Error",
"justification": "The END, IF, REPEAT, UNTIL, FOR, WHILE, and CASE statement should always start a line. IMPROVE CODE READABILITY."
},
{
"id": "AA0203",
"action": "Error",
"justification": "To avoid confusion, do not give methods the same name as fields or actions in the same scope. IMPROVE CODE READABILITY."
},
{
"id": "AA0201",
"action": "Error",
"justification": "When ApplicationArea is set to 'Basic', you must also specify 'Suite'. BEST PRACTICES."
},
{
"id": "AL0424",
"action": "Error",
"justification": "The multilanguage syntax is being deprecated. Please update to the new syntax. BEST PRACTICES."
},
{
"id": "AA0225",
"action": "Error",
"justification": "You must specify a caption in the Caption property for Fields that exist on page objects. BEST PRACTICES."
},
{
"id": "AA0072",
"action": "None",
"justification": "The name of variables and parameters must be suffixed with the type or object name. BEST PRACTICES."
},
{
"id": "AA0218",
"action": "Error",
"justification": "You must write a tooltip in the Tooltip property for all controls of type Action and Field that exist on page objects. BEST PRACTICES."
},
{
"id": "AA0217",
"action": "None",
"justification": "Use a text constant or label for format string in StrSubstNo. BEST PRACTICES."
},
{
"id": "AW0011",
"action": "Error",
"justification": "Add PromotedOnly=true to some or all promoted actions to avoid identical actions from appearing in both the promoted and default sections of the command bar. BEST PRACTICES."
},
{
"id": "AA0101",
"action": "Error",
"justification": "Use camel case property values in pages of type API. BEST PRACTICES."
},
{
"id": "AA0102",
"action": "Error",
"justification": "Use camel case name for field controls in pages of type API. BEST PRACTICES."
},
{
"id": "AS0011",
"action": "Error",
"justification": "AppSourceCop Error. An affix is required. INVESTIGATE IF NEEDED IN YOUR PROJECT."
}
]
}
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
"cSpell.words": [
"Pedersen"
],
"al-xml-doc.InitializeALObjectCacheOnStartUp": false
"al-xml-doc.InitializeALObjectCacheOnStartUp": false,
"al.enableCodeAnalysis": true,
"al.codeAnalyzers": [
"${UICop}",
"${CodeCop}"
],
"al.backgroundCodeAnalysis": "Project",
"al.browser": "Edge",
"al.ruleSetPath": "./.vscode/AfterConversion.ruleset.json"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ codeunit 50141 "FPFr Event Subscribers"
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Blnkt Sales Ord. to Ord. (Y/N)", 'OnAfterCreateSalesOrder', '', true, true)]
local procedure SubscriptionOnAfterCreateSalesOrder(var SalesHeader: Record "Sales Header"; var SkipMessage: Boolean)
var
SalesLine: Record "Sales Line";
SalesPost: Codeunit "Sales-Post";
begin
if not (SalesHeader.Ship and SalesHeader.Invoice) then begin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Report 50142 "FPFr Make Orders Batch"
report 50142 "FPFr Make Orders Batch"
{
Caption = 'Make Orders from Blanket Order Lines ready to ship';
ProcessingOnly = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Report 50140 "FPFr Next Periode Calc Batch"
report 50140 "FPFr Next Periode Calc Batch"
{
Caption = 'Calculate Next Subscription Period';
ProcessingOnly = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Report 50141 "FPFr Qty to Ship Calc Batch"
report 50141 "FPFr Qty to Ship Calc Batch"
{
Caption = 'Calculate Quantity to Ship';
ProcessingOnly = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PageExtension 50142 "FPFr Sub. Order Subform" extends "Blanket Sales Order Subform"
pageextension 50142 "FPFr Sub. Order Subform" extends "Blanket Sales Order Subform"
{
layout
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Page 50140 "FPFr Sub. Sales Order Lines"
page 50140 "FPFr Sub. Sales Order Lines"
{
Caption = 'Subscription Sales Order Lines';
PageType = List;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TableExtension 50140 "FPFr Subscription Item" extends Item
tableextension 50140 "FPFr Subscription Item" extends Item
{
fields
{
Expand All @@ -17,7 +17,6 @@ TableExtension 50140 "FPFr Subscription Item" extends Item
{
trigger OnValidate()
var
DateFormularZero: DateFormula;
DateFormulaErr: TextConst ENU = 'The Date Formula %1 will not calculate a date in the future. Please enter a correct Date Formula.';
begin
if not (CalcDate("Subscription Periodicity", WorkDate()) > WorkDate()) then
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PageExtension 50143 "FPFr Subscription Order" extends "Blanket Sales Order"
pageextension 50143 "FPFr Subscription Order" extends "Blanket Sales Order"
{
actions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PageExtension 50144 "FPFr Subscription Orders" extends "Blanket Sales Orders"
pageextension 50144 "FPFr Subscription Orders" extends "Blanket Sales Orders"
{
actions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TableExtension 50141 "FPFr Subscription Sales Line" extends "Sales Line"
tableextension 50141 "FPFr Subscription Sales Line" extends "Sales Line"
{
fields
{
Expand All @@ -17,7 +17,6 @@ TableExtension 50141 "FPFr Subscription Sales Line" extends "Sales Line"
{
trigger OnValidate()
var
DateFormularZero: DateFormula;
DateFormulaErr: TextConst ENU = 'The Date Formula %1 will not calculate a date in the future. Please enter a correct Date Formula.';
begin
if not (CalcDate("Subscription Periodicity", WorkDate()) > WorkDate()) then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ codeunit 50144 "FPFr Test Subscription App"
SalesHeader: Record "Sales Header";
SalesLine1: Record "Sales Line";
SalesLine2: Record "Sales Line";
FPFrSubscriptionEnum: Enum "FPFr Subscription Enum";
FPFrSubscriptionMgt: Codeunit "FPFr Subscription Management";
DateExpression: DateFormula;
ThisDay: Date;
NextDay: Date;
LineNumber: Integer;
Counter: Integer;
DebuggingMode: Boolean;
Expand Down Expand Up @@ -81,6 +79,7 @@ codeunit 50144 "FPFr Test Subscription App"
Item1.Validate("Subscription Periodicity", DateExpression);
Item1.Modify(true);

Item2.FindSet();
Item2.Next();
Item2.Validate("Subscription Type", Item2."Subscription Type"::Recurring);
Evaluate(DateExpression, '<1D>');
Expand Down Expand Up @@ -155,7 +154,7 @@ codeunit 50144 "FPFr Test Subscription App"
FPFrSubscriptionMgt.CalculateNextSubscriptionPeriodYN(SalesHeader);
BlanketOrderStatus := SalesHeaderStatus(SalesHeader);

ThisDay := CalcDate('1D', ThisDay);
ThisDay := CalcDate('<1D>', ThisDay);
WorkDate(ThisDay);
end;

Expand Down Expand Up @@ -189,7 +188,7 @@ codeunit 50144 "FPFr Test Subscription App"
if SalesLine.FindSet() then
repeat
String := String +
StrSubstNo('Line %1, Date %2, Qty %3, To Ship %4, To inv %5, Shipped %6, Invoiced %6\',
StrSubstNo('Line %1, Date %2, Qty %3, To Ship %4, To inv %5, Shipped %6, Invoiced %7\',
SalesLine."Line No.",
Format(SalesLine."Shipment Date", 0, 9),
SalesLine.Quantity,
Expand Down

0 comments on commit dd21230

Please sign in to comment.