-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update CandidateGradeController.cls #400
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review not passed
This is the summary of issues introduced by this change:
Policy name | Issues |
---|---|
Intentional | 0 |
Reliable | 1 |
Compliant | 0 |
Secure | 0 |
Automated | 0 |
Composable | 0 |
Resilient | 0 |
Engaging | 0 |
@@ -11,6 +11,10 @@ public class CandidateGradeController { | |||
User currentUser = [SELECT Seniority__c FROM User where Id = :UserInfo.getUserId()]; | |||
String temperature = ''; | |||
Double commission = 0; | |||
|
|||
for (int i = 0; i < 5; i++) { | |||
Contact currentContacti = [SELECT Name, Salary__c, NextAvailableDate__c FROM Contact where Id = :contactId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reliable: Data access in loop
Severity
Error
Finding
This data query is inside a loop. Please move the query outside the loop and put records in collections for processing.
Why is this a problem?
Salesforce enforce a limit on the number of SOSL and DML statements per transaction. Reading or writing data inside loops is highly likely to hit such limits.
Help and documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congrats, your code passed without warnings 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review not passed
This is the summary of issues introduced by this change:
Policy name | Issues |
---|---|
Compliant | 0 |
Resilient | 0 |
Intentional | 0 |
Secure | 0 |
Engaging | 0 |
Reliable | 1 |
DB Custom Policy | 2 |
Automated | 0 |
Composable | 0 |
@@ -6,11 +6,17 @@ public class CandidateGradeController { | |||
// comment 22222 gianc | |||
@AuraEnabled | |||
public static CandidateGradeInfo getCandidateGrade(Id contactId) { | |||
|
|||
List<Account> accs = [SELECT Id, Name FROM Account]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reliable: SOQL query without limits
Severity
Error
Finding
The result of this query is not bound. Please use a LIMIT
or a WHERE
clause to limit the number of results.
Why is this a problem?
Salesforce limits the maximum number of rows that a SOQL query can return to 50,000 records. When this number is exceeded, a runtime exception is thrown. As a best practice, developers should always use either a WHERE or a LIMIT clause to cap the maximum number of results.
Help and documentation
@@ -6,11 +6,17 @@ public class CandidateGradeController { | |||
// comment 22222 gianc | |||
@AuraEnabled | |||
public static CandidateGradeInfo getCandidateGrade(Id contactId) { | |||
|
|||
List<Account> accs = [SELECT Id, Name FROM Account]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DB Custom Policy: Use of direct embedded SOQL expression
Severity
Critical
Finding
This SOQL statement doesn't use the new utility framework. Please consider refactoring using the new utility framework
Why is this a problem?
Make sure all the SOQL statements use the new utility framework to ensure all proper CRDU/FLS checks are performed
|
||
Contact currentContact = [SELECT Name, Salary__c, NextAvailableDate__c FROM Contact where Id = :contactId]; | ||
User currentUser = [SELECT Seniority__c FROM User where Id = :UserInfo.getUserId()]; | ||
String temperature = ''; | ||
Double commission = 0; | ||
|
||
for (int i = 0; i < 5; i++) { | ||
Contact currentContacti = [SELECT Name, Salary__c, NextAvailableDate__c FROM Contact where Id = :contactId]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DB Custom Policy: Use of direct embedded SOQL expression
Severity
Critical
Finding
This SOQL statement doesn't use the new utility framework. Please consider refactoring using the new utility framework
Why is this a problem?
Make sure all the SOQL statements use the new utility framework to ensure all proper CRDU/FLS checks are performed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review not passed
This is the summary of issues introduced by this change:
Policy name | Issues |
---|---|
Large Data Volumes | 2 |
Security (Orgs) | 0 |
Error Handling | 0 |
Development Essentials | 0 |
Testing Best Practice | 0 |
No description provided.