Skip to content

NEW @W-21910054@ Make ApexGuru opt-in (apex-guru tag), reconcile rule severities, and reduce API timeout to 5 minutes - #502

Open
nikhil-mittal-165 wants to merge 2 commits into
devfrom
severity-changes-apexguru
Open

NEW @W-21910054@ Make ApexGuru opt-in (apex-guru tag), reconcile rule severities, and reduce API timeout to 5 minutes#502
nikhil-mittal-165 wants to merge 2 commits into
devfrom
severity-changes-apexguru

Conversation

@nikhil-mittal-165

@nikhil-mittal-165 nikhil-mittal-165 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

What

Three related changes to the ApexGuru engine:

  1. Severity reconciliation — correct the severity levels of the known ApexGuru rules in apexguru-rules.ts and regroup the rule list by severity (High / Moderate / Low).
  2. Make ApexGuru opt-in — the engine no longer runs in default scans. Its rules run only when explicitly requested.
  3. Reduce API timeout — from 10 minutes to 5 minutes.

1. Severity changes

Six rules had their severity updated:

Rule Before After
SchemaGetGlobalDescribeNotEfficient Moderate High
SoqlWithoutPlatformCache Moderate High
SoqlInALoopOneHop High Moderate
SoqlWithoutAWhereClauseOrLimitStatement Moderate Low
SoqlWithWildcardFilter Moderate Low
SoqlWithNegativeExpressions Moderate Low

The remaining rules already matched the intended severities.

Final classification

  • High (5): SoqlInALoop, DmlInALoop, ExpensiveMethods, SchemaGetGlobalDescribeNotEfficient, SoqlWithoutPlatformCache
  • Moderate (6): SoqlInALoopOneHop, Soql Aggregation, SoqlWithApexFilter, CopyingListOrSetElementsUsingAForLoop, Redundant Soql, SObjectMapInAForLoop
  • Low (11): SoqlWithoutAWhereClauseOrLimitStatement, SoqlWithWildcardFilter, SoqlWithNegativeExpressions, LimitsGetHeapsizeMethods, ExpensiveStringComparison, ExpensiveDebugStatements, UsingTheTestMethodKeyword, SortingInApex, BusyLoopDelay, SoqlWithUnusedFields, WritingFillerStatements

Note: code-analyzer-engine-api has no Medium severity level; the medium tier maps to SeverityLevel.Moderate.

2. ApexGuru is now opt-in

ApexGuru rules no longer run in default scans. They are excluded from the Recommended default, the all selector, and severity-based selectors. They run only when explicitly requested by:

  • engine name — --rule-selector apexguru, or
  • the opt-in tag — --rule-selector apex-guru

This replaces the removed DevPreviewApexGuru opt-in tag with the better-named apex-guru tag. The opt-in exclusion is enforced in code-analyzer-core's rule selection logic, which special-cases this tag.

3. API timeout

The ApexGuru API timeout default was reduced from 600000 ms (10 minutes) to 300000 ms (5 minutes) in config.ts.

Cleanup

Collapsed the previous "CRITICAL / PERFORMANCE ONLY / BEST PRACTICES" sub-headers into three clean severity-based section headers.

Testing

  • @salesforce/code-analyzer-apexguru-engine: 84/84 tests pass.
  • @salesforce/code-analyzer-core: 445/445 tests pass.
  • Lint clean on both packages.
  • Added/updated rule-selection tests asserting ApexGuru rules are NOT selected by Recommended, all, or severity selectors, and ARE selected by engine name, rule name, and the apex-guru tag.

@git2gus

git2gus Bot commented Aug 20, 2026

Copy link
Copy Markdown

Git2Gus App is installed but the .git2gus/config.json doesn't have right values. You should add the required configuration.

…duce API timeout to 5 minutes

- ApexGuru rules no longer run in default scans. They are excluded from
  the "Recommended" default, "all", and severity-based selectors, and now
  run only when explicitly requested by engine name (apexguru) or the
  apex-guru tag (e.g. --rule-selector apex-guru).
- Replaced the removed DevPreviewApexGuru opt-in tag with apex-guru.
- Reduced the ApexGuru API timeout default from 10 minutes to 5 minutes.
@nikhil-mittal-165 nikhil-mittal-165 changed the title NEW @W-21910054@ ApexGuru rule severity changes NEW @W-21910054@ Make ApexGuru opt-in (apex-guru tag), reconcile rule severities, and reduce API timeout to 5 minutes Aug 20, 2026

@aruntyagiTutu aruntyagiTutu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed against the PR guide. Single-concern change confined to apexguru-rules.ts — six rule severities reclassified plus the section-header comments regrouped by severity to match. Verified:

  • SeverityLevel enum in code-analyzer-engine-api/src/rules.ts has Critical/High/Moderate/Low/Info, no Medium — confirms the PR description's note that "medium" maps to Moderate is accurate, not a workaround.
  • No rule names, descriptions, tags, or resourceUrls were altered — only severityLevel values and comment banners moved. apexguru-rules.test.ts's invariant checks (23 rules, consistent tags, no removed tag) are unaffected by this diff and still pass in CI.
  • CI is green across all three platforms.

No concerns. Clean, well-scoped, well-documented in the PR body with a clear before/after table.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants