Details
Description
A SonarCloud user gave this feedback about the rule RSPEC-5377:
"Not applicable as it defined in parent class. And access is inherited from the parent class."
public class BigMachinesQuoteModel extends BaseTriggerHandler { // Noncompliant but FP
Before raising on a child class defined without sharing rules, the analyzer should check if the parent as defined sharing rules, if it the case it's compliant:
public with sharing class BaseTriggerHandler { // OR public without sharing class BaseTriggerHandler { // OR public inherited sharing class BaseTriggerHandler { // ... public class BigMachinesQuoteModel extends BaseTriggerHandler { // Compliant
public class BaseTriggerHandler { // ... public class BigMachinesQuoteModel extends BaseTriggerHandler { // Noncompliant
For a first improvement we decided (see comments) to simply not raise on a child class.
Attachments
Issue Links
- implements
-
RSPEC-5377 Sharing level should be specified in Apex Classes with SOQL/SOSL Queries or DML Statements
- Active
- is related to
-
SONARSLANG-515 [Apex] FN in S5377: should raise when sharing properties are not inherited from parent.
-
- Open
-