Code Analyzer suppressions
Find every inline Salesforce Code Analyzer suppression in the Record Health Check package, exactly where each one is, and why it is safe to leave in place. For the security model of an installed org, see Security and data access.
AppExchange security-review readiness
Section titled “AppExchange security-review readiness”Record Health Check is engineered for AppExchange security-review readiness. Its release process keeps Salesforce Code Analyzer rules enabled by default, fails on new unsanctioned findings, and requires every narrow suppression to be documented and reviewable on this page. Those controls are supplemented by clean-source CI, permission-assignment tests, adversarial tests, package-boundary checks, and Salesforce runtime validation.
This readiness statement describes the repository’s engineering controls. It is not a claim that a specific package version has passed Salesforce AppExchange Security Review, and it does not replace Salesforce’s submission, automated scanning, manual review, clean-install, or integration-review requirements. State that a release is AppExchange approved only after Salesforce has approved that exact submitted solution and version.
Use this table to look up a suppression by file, rule, or category. Every suppression is a comment placed directly above the line it covers:
// code-analyzer-suppress-next-line <RuleName>: <reason>The rule stays enabled for every other line in the package; a new violation anywhere else still fails the release scan. Reproduce this count from a clean checkout:
grep -rn "code-analyzer-suppress-next-line" \ packages/record-health-check/force-app \ packages/record-health-check/integration-tests36 lines in the 2.0.11 source: 26 in the core package and 10 in the integration test harness.
Two core classes also carry a class-level annotation instead of an inline comment:
RecordHealthCheckFieldPlanner.cls and RecordHealthCheckQuerySchemaValidator.cls use
@SuppressWarnings('PMD.IfStmtsMustUseBraces,PMD.IfElseStmtsMustUseBraces'), a brace-style rule
only. The release gate’s inventory, config/code-analyzer-inline-suppressions.json, lists all 38
entries and fails when the source and the inventory disagree.
Core package
Section titled “Core package”26 suppressions across four rules.
Custom Metadata reads
Section titled “Custom Metadata reads”Check Sets and Checks are stored as Custom Metadata Types
(Record_Health_Check_Set__mdt, Record_Health_Check__mdt). Salesforce always lets Apex read a
Custom Metadata Type record. It does not apply the same-object read permission or field-level
security it applies to Accounts, Contacts, and other business records. That is a Salesforce
platform behavior, not a gap in Record Health Check’s own code
(Trailhead: Protect Custom Metadata Types & Records).
Adding WITH USER_MODE to a query like this would have no effect, since Custom Metadata Type
reads bypass record and field access checks either way.
Most reads below happen after Record Health Check’s own permission check confirms the user is
allowed to run Checks at all (RecordHealthCheckAccess.canRunChecks()).
| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckAsyncSupport. | 65 | ApexCRUDViolation | Confirms that the Check Set is active and reads its object before a Batch, Queueable, or Scheduled job is submitted. |
RecordHealthCheckConfigService. | 61 | ApexCRUDViolation | Loads the Check Set’s card heading and Run-button settings before the Check definitions load. |
RecordHealthCheckConfigService. | 80 | ApexCRUDViolation | Counts the Check Set’s active Checks for that first card view. |
RecordHealthCheckConfigService. | 88 | ApexCRUDViolation | Counts the Check Set’s inactive Checks for that first card view. |
RecordHealthCheckConfigService. | 175 | ApexCRUDViolation | Finds which Check Set a given Check belongs to. |
RecordHealthCheckConfigService. | 199 | ApexCRUDViolation | Checks which object every Check Set targets and whether it is active, to find the ones that apply to the current record page. |
RecordHealthCheckConfigService. | 339 | ApexCRUDViolation | Loads one Check’s configuration immediately before it runs. |
RecordHealthCheckController. | 451 | ApexCRUDViolation | Confirms that a Check belongs to the Check Set the caller names. |
RecordHealthCheckDefinitionLoader. | 46 | ApexCRUDViolation | Loads the Check Set Custom Metadata record shown on the card. |
RecordHealthCheckDefinitionLoader. | 87 | ApexCRUDViolation | Loads the Checks that belong to that Check Set. |
RecordHealthCheckDefinitionLoader. | 422 | ApexCRUDViolation | Counts a Check Set’s inactive Checks for the administrator tooltip. |
RecordHealthCheckDefinitionLoader. | 440 | ApexCRUDViolation | Lists those inactive Checks’ names for that same tooltip. |
RecordHealthCheckMetadataValidator. | 50 | ApexCRUDViolation | Reads every Check Set, active or inactive, so an administrator’s configuration can be validated. |
RecordHealthCheckMetadataValidator. | 73 | ApexCRUDViolation | Reads every Check for that same administrator-facing validation. |
RecordHealthCheckPreviewService. | 107 | ApexCRUDViolation | Loads the saved Check Set that owns a Preview, after Admin and Run authorization. |
RecordHealthCheckPreviewService. | 212 | ApexCRUDViolation | Reads the saved Check’s identity so a detached draft cannot impersonate an existing Check. |
RecordHealthCheckScopePlanner. | 42 | ApexCRUDViolation | Loads the Check Set’s own configuration. The Account, Contact, or other records it evaluates are queried separately, using the running user’s real record access (WITH USER_). |
RecordHealthCheckSetPicklist. | 54 | ApexCRUDViolation | Lists active Check Sets for the picker an administrator sees while building a Lightning page. |
RecordHealthCheckSettingsProvider. | 10 | ApexCRUDViolation | Reads whether a Check Set publishes Log events. Not a subscriber’s business record. |
RecordHealthCheckSettingsProvider. | 24 | ApexCRUDViolation | Reads whether a Check Set publishes its interactive run event. |
RecordHealthCheckSettingsProvider. | 39 | ApexCRUDViolation | Reads which Checks publish their interactive result events. |
Readiness receipt write
Section titled “Readiness receipt write”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckReadinessService. | 46 | ApexCRUDViolation | Saves the immutable readiness receipt after Admin and Run authorization. Administrators cannot create receipts directly, so the service writes this server-owned evidence itself. |
Dynamic scope query
Section titled “Dynamic scope query”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckScopeRecordLoader. | 128 | ApexSOQLInjection | Builds the query that loads the records’ field values for evaluation. The record IDs come in as a bind variable, the object and field names are checked against Salesforce’s own schema first, and the query runs with the user’s real record access (WITH USER_). |
Schema describe cache
Section titled “Schema describe cache”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckDescribeCache. | 36 | AvoidMultipleMassSchemaLookups | Looks up Salesforce’s object and field metadata once per transaction and reuses it, instead of asking Salesforce again for every Check. |
Deliberately-unsafe test fixtures
Section titled “Deliberately-unsafe test fixtures”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckContractHarnessTest. | 119 | OperationWithLimitsInLoop | This test plugin deliberately queries one record at a time, to prove the contract test detects query growth in a custom Apex Check. |
RecordHealthCheckScopePlannerTest. | 235 | OperationWithLimitsInLoop | This test deliberately uses up all but two of the query slots, to prove the planner blocks a Check that would need three. |
Fix the finding in source
Section titled “Fix the finding in source”Not every finding here got a suppression comment. AvoidHardcodedCredentialsInFieldDecls matched
a field named AUTHORIZATION_MESSAGE in three classes; its heuristic matched the word
“AUTHORIZATION” in the field name, not its value, which was always a plain user-facing message
(“You do not have permission to run Record Health Checks.”). Since this was a naming collision and
not a real access-control question, the field was renamed instead of suppressed:
| File | Change |
|---|---|
RecordHealthCheckAgentRestResource. | AUTHORIZATION_ renamed to PERMISSION_ |
RecordHealthCheckRunCheckAgentAction. | AUTHORIZATION_ renamed to PERMISSION_ |
RecordHealthCheckRunSetAgentAction. | AUTHORIZATION_ renamed to PERMISSION_ |
The public 'AUTHORIZATION' reason code these classes return to callers, documented in the
Agent tool contract, did not change. Only the private field
holding the message text did.
Repository-only integration tests
Section titled “Repository-only integration tests”10 suppressions. This package only runs in a scratch org during development. It is never packaged, never installed in a subscriber org, and ships with none of the metadata described here.
Contract-test fixture
Section titled “Contract-test fixture”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckContractHarnessTest. | 149 | OperationWithLimitsInLoop | The integration copy of the deliberately non-bulk test plugin, used to prove that the contract test detects record-count-dependent query growth. |
Benchmark telemetry
Section titled “Benchmark telemetry”RHC_Benchmark_Result__c is a regular custom object, not a Custom Metadata Type. It holds
performance numbers from admin-run benchmark tests and nothing else. It is suppressed because it is
disposable test-org infrastructure that a subscriber never sees, not because record access rules
don’t apply to it.
| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckScaleBenchmark. | 22 | ApexCRUDViolation | Writes a new row to the benchmark’s own results object, which exists only in the test org. |
RecordHealthCheckScaleBenchmark. | 29 | ApexCRUDViolation | Saves the async job ID on that same results row. |
RecordHealthCheckScaleBenchmark. | 57 | ApexCRUDViolation | Writes benchmark results even when the running user’s Permission Set intentionally has no access to the results object; the benchmark still needs to record what happened. |
RecordHealthCheckScaleBenchmark. | 68 | ApexCRUDViolation | Saves the job ID on the results row for a specific benchmark run. |
RecordHealthCheckScaleBenchmark. | 85 | ApexCRUDViolation | Reads the benchmark results report. Enforcing normal field-level security here would make the benchmark’s own fields unreadable to the person running it. |
RecordHealthCheckScaleBenchmark. | 120 | ApexCRUDViolation | Looks up one benchmark run’s results row by its run ID. |
Scratch-org exhaustive harness
Section titled “Scratch-org exhaustive harness”| File | Line | Rule | What this line does |
|---|---|---|---|
RecordHealthCheckExhaustiveSmoke. | 26 | OperationWithLimitsInLoop | Starts one background (Queueable) job at a time, up to Salesforce’s 50-job-per-transaction limit. Salesforce does not offer a bulk way to start Queueable jobs. |
RecordHealthCheckExhaustiveSmoke. | 54 | OperationWithLimitsInLoop | Starts the next group of background jobs, capped at that same 50-job limit. |
RecordHealthCheckExhaustiveSmoke. | 105 | QueueableWithoutFinalizer | This one-time test harness saves its own result directly; it has no follow-up job, so it does not need Salesforce’s Queueable Finalizer cleanup step. |