Skip to content

Commit 4fceb75

Browse files
authored
Merge pull request #1037 from forcedotcom/dev
RELEASE: @W-12699834@: Promote dev to release for 3.11.0
2 parents 33e0fff + a61a91e commit 4fceb75

File tree

89 files changed

+3500
-2139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+3500
-2139
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ Instructions [here](CONTRIBUTING.md).
2121

2222
# Usage
2323

24-
Here is the information on [How to Install the plugin](https://forcedotcom.github.io/sfdx-scanner/en/getting-started/install/)
24+
Here is the information on [How to Install the plugin](https://forcedotcom.github.io/sfdx-scanner/en/v3.x/getting-started/install/)
2525

26-
Please check out the [Salesforce CLI Scanner Plug-In Command Reference](https://forcedotcom.github.io/sfdx-scanner/en/scanner-commands/run/) for usage and demo of the plugin.
26+
Please check out the [Salesforce CLI Scanner Plug-In Command Reference](https://forcedotcom.github.io/sfdx-scanner/en/v3.x/scanner-commands/run/) for usage and demo of the plugin.

messages/run-common.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
module.exports = {
22
"flags": {
3+
"categoryDescription": "one or more categories of rules to run",
4+
"categoryDescriptionLong": "One or more categories of rules to run. Specify multiple values as a comma-separated list.",
35
"formatDescription": "specify results output format",
46
"formatDescriptionLong": "Specifies results output format written directly to the console.",
57
"normalizesevDescription": "return normalized severity 1 (high), 2 (moderate), and 3 (low), and the engine-specific severity",

messages/run-dfa.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

messages/run-pathless.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module.exports = {
22
"commandDescription": "scan a codebase with a selection of rules",
33
"commandDescriptionLong": `Scans a codebase with a selection of rules. You can scan the codebase with all the rules in the registry, or use parameters to filter the rules based on rulename, category, or ruleset. You can specify the format of the output, such as XML or JUnit. You can print the output to the console (default) or to a file using the --outfile parameter.`,
44
"flags": {
5-
"categoryDescription": "one or more categories of rules to run",
6-
"categoryDescriptionLong": "One or more categories of rules to run. Specify multiple values as a comma-separated list.",
75
"rulesetDescription": "[deprecated] rulesets to run",
86
"rulesetDescriptionLong": "[deprecated] One or more rulesets to run. Specify multiple values as a comma-separated list.",
97
"targetDescription": "source code location",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@salesforce/sfdx-scanner",
33
"description": "Static code scanner that applies quality and security rules to Apex code, and provides feedback.",
4-
"version": "3.10.0",
4+
"version": "3.11.0",
55
"author": "ISV SWAT",
66
"bugs": "https://github.com/forcedotcom/sfdx-scanner/issues",
77
"dependencies": {

pmd-cataloger/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ group = "sfdx"
99
version = "1.0"
1010

1111
val distDir = "$buildDir/../../dist"
12-
val pmdVersion = "6.54.0"
12+
val pmdVersion = "6.55.0"
1313
val pmdFile = "pmd-bin-$pmdVersion.zip"
1414
val pmdUrl = "https://github.com/pmd/pmd/releases/download/pmd_releases%2F${pmdVersion}/${pmdFile}"
1515
val skippableJarRegexes = setOf("""^common_[\d\.-]*\.jar""".toRegex(),

sfge/src/main/java/com/salesforce/Main.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ int process(String... args) {
8585
}
8686
if (args.length == 0) {
8787
// No args means we can't do anything productive.
88-
dependencies.printError(UserFacingMessages.REQUIRES_AT_LEAST_ONE_ARGUMENT);
88+
dependencies.printError(
89+
UserFacingMessages.InvocationErrors.REQUIRES_AT_LEAST_ONE_ARGUMENT);
8990
return EXIT_WITH_INTERNAL_ERROR_NO_VIOLATIONS;
9091
}
9192

@@ -222,7 +223,7 @@ private String formatError(Throwable error) {
222223
return ERROR_PREFIX
223224
+ (error.getCause() != null
224225
? String.format(
225-
UserFacingMessages.EXCEPTION_FORMAT_TEMPLATE,
226+
UserFacingMessages.CompilationErrors.EXCEPTION_FORMAT_TEMPLATE,
226227
error.getMessage(),
227228
error.getCause().getMessage())
228229
: error.getMessage());

sfge/src/main/java/com/salesforce/apex/jorje/JorjeUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ public static AstNodeWrapper<?> compileApexFromString(String sourceCode) {
8787
.map(
8888
e ->
8989
String.format(
90-
UserFacingMessages.INVALID_SYNTAX_TEMPLATE,
90+
UserFacingMessages.CompilationErrors
91+
.INVALID_SYNTAX_TEMPLATE,
9192
e.getLoc().getLine(),
9293
e.getLoc().getColumn(),
9394
e.getError()))

sfge/src/main/java/com/salesforce/cli/CliArgParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public CLI_ACTION getCliAction(String... args) {
3737
return CLI_ACTION.CATALOG;
3838
} else {
3939
throw new InvocationException(
40-
String.format(UserFacingMessages.UNRECOGNIZED_ACTION, actionArg));
40+
String.format(
41+
UserFacingMessages.InvocationErrors.UNRECOGNIZED_ACTION, actionArg));
4142
}
4243
}
4344

@@ -120,7 +121,7 @@ public void parseArgs(String... args) {
120121
if (args.length != ARG_COUNT) {
121122
throw new InvocationException(
122123
String.format(
123-
UserFacingMessages.INCORRECT_ARGUMENT_COUNT,
124+
UserFacingMessages.InvocationErrors.INCORRECT_ARGUMENT_COUNT,
124125
ARG_COUNT,
125126
args.length));
126127
}

sfge/src/main/java/com/salesforce/config/UserFacingMessages.java

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
public final class UserFacingMessages {
99

1010
public static final class RuleDescriptions {
11+
public static final String APEX_NULL_POINTER_EXCEPTION_RULE =
12+
"Identfies Apex operations that dereference null objects and throw NullPointerExceptions.";
1113
public static final String UNIMPLEMENTED_TYPE_RULE =
1214
"Identifies abstract classes and interfaces that are non-global and don't have implementations or extensions.";
1315
}
1416

1517
public static final class RuleViolationTemplates {
18+
public static final String APEX_NULL_POINTER_EXCEPTION_RULE =
19+
"%s dereferences a null object. Review your code and add a null check.";
1620
/** CRUD/FLS Violation messages */
1721
// format: "CRUD" or "FLS", DML operation, Object type, Field information
1822
public static final String MISSING_CRUD_FLS_CHECK =
@@ -21,46 +25,50 @@ public static final class RuleViolationTemplates {
2125
// Second %s is the name of a class or interface.
2226
public static final String UNIMPLEMENTED_TYPE_RULE = "Extend, implement, or delete %s %s";
2327
public static final String LIMIT_REACHED_VIOLATION_MESSAGE =
24-
"%s. The analysis preemptively stopped running on this path to prevent an OutOfMemory error. Rerun Graph Engine targeting this entry method with a larger heap space.";
28+
"%s. The analysis preemptively stopped running on this path to prevent an OutOfMemory error. Rerun Graph Engine and target this entry method with a larger heap space.";
2529
}
2630

2731
/** Main args and process checks * */
28-
public static final String REQUIRES_AT_LEAST_ONE_ARGUMENT =
29-
"SFGE invocation requires at least one argument.";
30-
31-
public static final String UNRECOGNIZED_ACTION = "Unrecognized action to invoke SFGE: %s.";
32-
public static final String INCORRECT_ARGUMENT_COUNT =
33-
"Wrong number of arguments. Expected %d; received %d";
32+
public static final class InvocationErrors {
33+
public static final String REQUIRES_AT_LEAST_ONE_ARGUMENT =
34+
"SFGE invocation requires at least one argument.";
35+
public static final String UNRECOGNIZED_ACTION = "Unrecognized action to invoke SFGE: %s.";
36+
public static final String INCORRECT_ARGUMENT_COUNT =
37+
"Wrong number of arguments. Expected %d; received %d";
38+
}
3439

3540
/** UserActionException * */
41+
public static final class UserActionMessage {
42+
// format: filename,defined type, line number
43+
public static final String UNREACHABLE_CODE =
44+
"Remove unreachable code to proceed with the analysis: %s,%s:%d";
45+
public static final String VARIABLE_DECLARED_MULTIPLE_TIMES =
46+
"Rename or delete this reused variable to proceed with the analysis: %s,%s:%d";
47+
}
3648

37-
// format: filename,defined type, line number
38-
public static final String UNREACHABLE_CODE =
39-
"Remove unreachable code to proceed with the analysis: %s,%s:%d";
40-
41-
public static final String VARIABLE_DECLARED_MULTIPLE_TIMES =
42-
"This variable is reused. Rename or delete it to proceed with the analysis: %s,%s:%d";
43-
44-
public static final String INSUFFICIENT_HEAP_SPACE =
45-
"There's insufficient heap space (%d bytes) to execute Graph Engine. Increase heap space using --sfgejvmargs option and retry.";
46-
47-
public static final String STRIP_INACCESSIBLE_READ_WARNING_TEMPLATE =
48-
"For stripInaccessible checks on READ operation, Salesforce Graph Engine can't verify that only sanitized data is used after the check. Discard unsanitized data for [%2$s].";
49-
50-
public static final String UNRESOLVED_CRUD_FLS_TEMPLATE =
51-
"Salesforce Graph Engine couldn't resolve the parameter passed to [%2$s] operation%4$s. Confirm that this operation has the necessary %1$s checks.";
52-
53-
public static final String FIELDS_MESSAGE_TEMPLATE = " with field(s) [%s]";
54-
public static final String FIELD_HANDLING_NOTICE =
55-
". Confirm that the objects and fields involved in these segments have FLS checks: [%s]";
49+
public static final class PathExpansionTemplates {
50+
public static final String INSUFFICIENT_HEAP_SPACE =
51+
"There's insufficient heap space (%d bytes) to execute Graph Engine. Increase heap space using the --sfgejvmargs option and retry.";
52+
public static final String PATH_EXPANSION_LIMIT_REACHED =
53+
"Graph Engine reached the path expansion upper limit (%d)";
54+
}
5655

57-
public static final String INVALID_SYNTAX_TEMPLATE = "Invalid syntax at %d:%d. (%s)";
56+
public static final class CrudFlsTemplates {
5857

59-
public static final String FIX_COMPILATION_ERRORS =
60-
"Graph engine encountered compilation errors. Fix the errors in %s and retry.";
58+
public static final String STRIP_INACCESSIBLE_READ_WARNING_TEMPLATE =
59+
"For stripInaccessible checks on READ operation, Salesforce Graph Engine can't verify that only sanitized data is used after the check. Discard unsanitized data for [%2$s].";
60+
public static final String UNRESOLVED_CRUD_FLS_TEMPLATE =
61+
"Salesforce Graph Engine couldn't resolve the parameter passed to [%2$s] operation%4$s. Confirm that this operation has the necessary %1$s checks.";
62+
public static final String FIELDS_MESSAGE_TEMPLATE = " with field(s) [%s]";
63+
public static final String FIELD_HANDLING_NOTICE =
64+
". Confirm that the objects and fields involved in these segments have FLS checks: [%s]";
65+
}
6166

62-
public static final String EXCEPTION_FORMAT_TEMPLATE = "%s, Caused by:\n%s";
67+
public static final class CompilationErrors {
6368

64-
public static final String PATH_EXPANSION_LIMIT_REACHED =
65-
"Graph Engine reached the path expansion upper limit (%d).";
69+
public static final String INVALID_SYNTAX_TEMPLATE = "Invalid syntax at %d:%d. (%s)";
70+
public static final String FIX_COMPILATION_ERRORS =
71+
"Graph engine encountered compilation errors. Fix the errors in %s and retry.";
72+
public static final String EXCEPTION_FORMAT_TEMPLATE = "%s, Caused by:\n%s";
73+
}
6674
}

0 commit comments

Comments
 (0)