Skip to content

Harden base ruleset: promote 21 rules back to Error - #10088

Open
Jesper Schulz-Wedde (JesperSchulz) wants to merge 4 commits into
mainfrom
jesperschulz-ruleset-hardening
Open

Harden base ruleset: promote 21 rules back to Error#10088
Jesper Schulz-Wedde (JesperSchulz) wants to merge 4 commits into
mainfrom
jesperschulz-ruleset-hardening

Conversation

@JesperSchulz

@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Why

After the BCApps migration enabled workspace compilation, every app compiles against a single shared ruleset (src/rulesets/base.ruleset.json). To get the workspace building, many analyzer rules were downgraded from Error to Warning. This PR starts walking that back, with the long-term goal of shrinking base.ruleset.json until it matches ./ruleset.json.

Related to AB#640773.

Approach

Rather than guessing, the downgraded rules were measured against a full CI/CD build — all 44 Build Apps <COUNTRY> (Default|Clean) jobs — and the warnings aggregated per job. Rules with zero real violations were promoted outright; rules with a handful of violations were fixed at source and then promoted. Larger changes are deliberately left for follow-up.

Note on the measurement: warnings are emitted in two log formats, ##[warning]<CODE> and ##[warning]code=<CODE> (the latter for diagnostics on non-AL files). An initial pass only matched the first form, which wrongly cleared AS0094, AL1026 and PTE0014. Those three are restored to Warning here with justifications; the data was re-mined with a corrected regex.

What changed

21 rules promoted from Warning back to Error (base.ruleset.json: 127 → 106 overrides):

AA0013, AA0189, AA0199, AA0213, AA0230, AA0604, AL0269, AL0424, AL0457, AL0482, AL0551, AL0590, AL0602, AL0775, AL0842, AS0075, AS0079, AS0111, AS0113, AS0126, PTE0017

Most had no violations at all. The rest needed small source fixes:

Rule Fixes Files
AL0457 11 Comment = 'Locked' replaced with Locked = true in IntrastatDE, IT VAT reporting, NA CartaPorte (8), NO EHF reminder
AA0013 4 begin moved onto the then/else line in W1/BE/IT SCMManufacturing70.Codeunit.al and GB Check.Report.al
AA0199 2 Application area ordering in NA SalesInvoice.Page.al and PostedSalesInvoices.Page.al
AA0189 1 Application area casing in IN GST SubcontractingOrderSubform.Page.al
AL0590 1 Redundant ShowAsTree on a non-tree group in TestTool.Page.al

The GB AA0013 was the trickiest: a #if not CLEAN27 directive sat between else and begin. The else is now duplicated into both preprocessor branches so begin follows it directly in the non-CLEAN27 branch, leaving both branches' behaviour unchanged.

3 rules kept as Warning, now with justifications: AS0094, AL1026, PTE0014. All three stem from a single root cause — 12 legacy extensionsPermissionSet.xml files (INTCS, INTDS, INTaxEngine) that need converting to AL PermissionSet objects. That is a substantial change and is tracked separately.

Validation

Full CI/CD build across all 44 country × build-mode jobs. No behavioural changes are intended — every source fix is a formatting, casing, ordering or metadata correction.

Follow-ups

  • Convert the 12 legacy XML permission sets, unlocking AS0094, AL1026 and PTE0014.
  • Rules needing product sign-off rather than just code: AL0679 (licensing entitlement), AW0014 (UI visibility), AA0203 (renames a request-page field bound by CZ/IT/W1 tests), plus AL0717, AL0523, AL0520, AL0589, AL0611, AL0468.
  • Revisit AS0139 and AL0920 in ruleset.json — their blocking bugs (#595767, #632280) are now closed.

With the corrected data, no zero-violation rules remain. The free wins are exhausted; each further step now needs a real source change or a product decision.

Removes Warning downgrades from base.ruleset.json for rules that produce zero warnings across a full CI build (all 22 countries x Default/Clean). These rules are defined as Error in their respective cop rulesets, so removing the override reverts them to Error, hardening the shared ruleset with no impact on the current build.

Related to AB#640773

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e6fd312-fe92-4215-8333-f98ba0a2e25d
@github-actions github-actions Bot added Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction labels Aug 10, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Aug 10, 2026
…to Error

Fixes the small number of source violations behind three more Warning downgrades in base.ruleset.json, then removes the downgrades so the rules revert to Error:

- AA0189 (1 site): lowercase 'suite' in ApplicationArea on Subcontracting Order Subform.
- AA0199 (2 sites): ApplicationArea order 'BasicMX, Suite' -> 'Suite, BasicMX' on the CFDIRelationDocuments actions.
- AL0590 (1 site): ShowAsTree set on a group (only supported on Repeater) in the Test Tool page.

All four changes are no-ops at runtime: the set of application areas is unchanged, and ShowAsTree has no effect outside a repeater. Verified no remaining occurrences in source.

Related to AB#640773

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 7e6fd312-fe92-4215-8333-f98ba0a2e25d
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Breaking\ Changes}$

This PR removes 22 diagnostic overrides from src/rulesets/base.ruleset.json (e.g. AL0269, AL0424, AL0482, AL0551, AL0602, AA0604, AL0775, AL0842, AA0189, AA0199, AL1026, AS0079, AS0094, AS0111, AS0113, AS0126, PTE0014, PTE0017, AS0075, AA0230, AA0213, AL0590), several of which carried explicit justifications tied to open bugs (e.g. 'Bug 472119', 'Bug 472148 ... multilanguage syntax is being deprecated', 'Bug 498357. Blocking platform uptake', 'Tracked by #501904'). base.ruleset.json includes ./ruleset.json with generalAction 'Error', so every removed override falls back to Error severity for all apps/projects that reference base.ruleset.json in their build configuration. This is effectively a breaking change to the build/CI contract for every app under this ruleset: previously-warned or suppressed diagnostics for those rule IDs will now fail the build unless the underlying code has already been fixed. Recommend verifying that all in-repo violations for these rule IDs have actually been remediated (not just that the suppression looked stale) before merging, or confirm this is an intentional, coordinated analyzer-hardening pass with a rollout plan for any consumers still relying on the softer warning level.

Agent judgement — not directly backed by a BCQuality knowledge article.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

Jesper Schulz-Wedde and others added 2 commits August 10, 2026 15:03
The IN (Clean) build failed on AS0094, AL1026 and PTE0014, which the previous
commit promoted to Error. They were misidentified as zero-violation because
warnings are emitted in two log formats ("##[warning]<CODE>" and
"##[warning]code=<CODE>") and only the first was mined. Re-mining all 44 build
jobs with both formats confirms the other 16 promoted rules genuinely have zero
violations.

All three stem from the same root cause: 12 legacy extensionsPermissionSet.xml
files in INTCS, INTDS and INTaxEngine that need converting to AL PermissionSet
objects. That is a larger migration, so they are restored to Warning with a
justification.

Also fixes and promotes two further rules:

- AL0457 (11 sites): Comment = 'Locked' -> Locked = true. The {Locked="..."}
  comment form is a different, valid construct and is left untouched.
- AA0013 (3 sites): a trailing comment after 'then' pushed 'begin' onto the next
  line; the comment moves above the statement.

Related to AB#640773

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7e6fd312-fe92-4215-8333-f98ba0a2e25d
The GB Base Application had a remaining AA0013 violation at
Bank/Check/Check.Report.al line 1185, where a #if not CLEAN27
directive separated the else from its begin.

The else is duplicated into both preprocessor branches so that
begin follows else on the same line in the non-CLEAN27 branch,
while the CLEAN27 branch keeps a bare else. Behaviour of both
branches is unchanged.

Related to AB#640773

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7e6fd312-fe92-4215-8333-f98ba0a2e25d
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) changed the title Harden base ruleset: promote 19 zero-violation rules back to Error Harden base ruleset: promote 21 rules back to Error Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

$\textbf{🟡\ Medium\ Severity\ —\ Breaking\ Changes}$

This PR removes 21 rule-specific "action": "Warning" overrides from src/rulesets/base.ruleset.json (AA0013, AA0189, AA0199, AA0213, AA0230, AA0604, AL0269, AL0424, AL0457, AL0482, AL0551, AL0590, AL0602, AL0775, AL0842, AS0075, AS0079, AS0111, AS0113, AS0126, PTE0017) while the ruleset's top-level "generalAction" remains "Error". Deleting these overrides silently promotes any surviving occurrence of those 21 diagnostics anywhere in the BCApps monorepo from a warning to a build-breaking error, but the rest of this PR is only a handful of unrelated, localized cosmetic fixes (Label Locked-property corrections, ApplicationArea casing, comment reformatting) rather than a repo-wide analyzer cleanup that would justify tightening these rules. Some removed entries carried bug-tracking justifications (e.g. "Bug 472119", "Bug 498357. Blocking platform uptake") suggesting they were deliberate, tracked suppressions — removing them without confirming the underlying issues are resolved everywhere risks breaking CI/build for unrelated teams. Recommend restoring the overrides in this PR (or splitting the ruleset tightening into its own change validated against a full-repo analyzer run for all 21 diagnostics) before merging.

Line mapping was unavailable, so this was posted as an issue comment.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.31.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Other GitHub request for other area than SCM, Finance or Integration Ownership: Needs Review Ownership is Other, low confidence, or needs manual correction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant