Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Gabriele-Clayton
Copy link
Contributor

No description provided.

Copy link

@clayton-staging clayton-staging bot left a 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

See the full report to learn more.

@@ -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];

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

@clayton-staging clayton-staging bot dismissed their stale review June 19, 2024 07:54

This code review is obsolete

clayton-staging[bot]
clayton-staging bot previously approved these changes Jun 19, 2024
Copy link

@clayton-staging clayton-staging bot left a 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 🚀

See the full report

@clayton-staging clayton-staging bot dismissed their stale review June 21, 2024 09:05

This code review is obsolete

Copy link

@clayton-staging clayton-staging bot left a 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

See the full report to learn more.

@@ -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];

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];

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];

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

Copy link

@clayton-staging clayton-staging bot left a 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

See the full report to learn more.

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.

None yet

1 participant