GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(handler): clear 4 Code Analyzer findings in TriggerHandler by dschach · Pull Request #373 · dschach/salesforce-trigger-framework

Conversation

@dschach

@dschach dschach commented Oct 30, 2026

Copy link
Copy Markdown
Owner

After the DevSecOps rules were added, Code Analyzer reported 7 findings in TriggerHandler.cls, none of them blocking. This pull request clears 4 of them: 2 with a small code change and 2 with a suppression whose reason the code states. No behavior changes. It covers the rest of items 52 and 53 of the 2026-10-29 quality analysis.

Changes

Fixes

  • AvoidMagicNumbers: the default maximum of the LoopCount() constructor is now the named constant DEFAULT_MAX_LOOP_COUNT, with an ApexDoc line. The constant sits in the outer class, because an Apex inner class cannot hold static members.
  • RequireInnerClassSharing: the inner class LoopCount declares inherited sharing.

Suppressions

  • CognitiveComplexity: PMD.CognitiveComplexity joins the class-level suppression, next to PMD.CyclomaticComplexity, which was already there for the same reason. Both rules report a total for the whole class, 184 against a limit of 50, while no method is above 6.
  • SwitchWithoutWhenElse: run() suppresses the rule, and its ApexDoc gives the reason: the switch names all 7 trigger operations, and validateRun() rejects a null operation. An empty when else was tried first and removed in favor of the suppression.

Behavior notes

  • No public member, message, or result changes.
  • The scan now reports 3 findings, all at severity 4: FieldNameMatchesClassName on the local variable loopCount, which the compatible cleanup in item 45 renames, and 2 FieldNameMatchesMethodName on the fields showLimits and showDebug, whose rename is breaking and waits for item 73.

Test plan

  • Scratch org at API 67.0: 46 of 46 local tests pass, with 100 percent coverage and no uncovered lines on TriggerHandler, AccountSampleTriggerHandler, and AccountSampleTrigger.
  • npm run codeanalyzer:run reports 3 findings, against 7 on main, and none at severity 1 or 2.
  • The Prettier check passes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Claude AI and others added 2 commits October 30, 2026 12:05
Claude AI @claude
refactor(handler): clear 4 Code Analyzer findings in TriggerHandler
9cb43f6
The default maximum of LoopCount() is the named constant DEFAULT_MAX_LOOP_COUNT, kept in the outer class because an Apex inner class cannot hold statics. LoopCount declares inherited sharing. The switch in run() has an empty when else whose comment says that its 7 cases are every trigger operation.

PMD.CognitiveComplexity joins the class-level suppression next to PMD.CyclomaticComplexity: both report a class total, 184 against a limit of 50, while no method is above 6. No behavior changes.

Co-Authored-By: Claude <[email protected]>
Claude AI @claude
refactor(handler): suppress SwitchWithoutWhenElse on run() instead
4af9bc3
The empty when else in run() is removed. run() suppresses PMD.SwitchWithoutWhenElse instead, and its ApexDoc gives the reason: the switch names all 7 trigger operations, and validateRun() rejects a null operation.

Co-Authored-By: Claude <[email protected]>
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (312e121) to head (4af9bc3).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #373   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          252       253    +1     
=========================================
+ Hits           252       253    +1     
Flag Coverage Δ
Apex 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dschach
dschach merged commit 3cc05e4 into main Oct 30, 2026
5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dschach
dschach deleted the refactor/analyzer-findings branch October 30, 2026 01:12
@dschach dschach mentioned this pull request Oct 30, 2026
chore(main): release 1.5.0 #370
Merged
dschach added a commit that referenced this pull request Oct 30, 2026
@github-actions @dschach
chore(main): release 1.5.0 (#370)
dfa1a99
🤖 I have created a release *beep* *boop*
---


##
[1.5.0](v1.4.2...v1.5.0)
(2026-10-30)


### Features

* **handler:** Let a test run a handler without DML
([312e121](312e121))
* **handler:** Route the framework messages through a log hook
([#372](#372))
([312e121](312e121))


### Code Refactoring

* **handler:** Clear 4 Code Analyzer findings in TriggerHandler
([#373](#373))
([3cc05e4](3cc05e4))


### Continuous Integration

* **apex-tests:** Run the Apex tests on pushes to main that change a
class
([#368](#368))
([e9a4ed3](e9a4ed3))
* **apex-tests:** Stop project config changes from starting a run
([e9a4ed3](e9a4ed3))
* **release-please:** Open release PRs with a token of their own
([#371](#371))
([94e1de0](94e1de0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: David Schach <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dschach
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.