-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode-analyzer.yml
More file actions
371 lines (322 loc) · 20.5 KB
/
code-analyzer.yml
File metadata and controls
371 lines (322 loc) · 20.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# ======================================================================
# CODE ANALYZER CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/config-custom.html
# ======================================================================
# The absolute folder path to which all other path values in this configuration may be relative to.
# If unspecified, or if specified as null, then the value is automatically chosen to be the parent folder of your Code Analyzer
# configuration file if it exists, or the current working directory otherwise.
config_root: null # Last calculated by the config command as: "/Users/abhisheksaxena/Documents/work-repos/CopadoSFDXAnalyzer"
# Folder where to store log files. May be an absolute path or a path relative to config_root.
# If unspecified, or if specified as null, then the value is automatically chosen to be your machine's default temporary directory.
log_folder: null # Last calculated by the config command as: "/var/folders/1c/k0x1t8vj7sl0mtdd332tx7zm0000gq/T"
# Level at which to log messages to log files.
# Possible values are:
# 1 or 'Error' - Includes only error messages in the log.
# 2 or 'Warn' - Includes warning and error messages in the log.
# 3 or 'Info' - Includes informative, warning, and error messages in the log.
# 4 or 'Debug' - Includes debug, informative, warning, and error messages in the log.
# 5 or 'Fine' - Includes fine detail, debug, informative, warning, and error messages in the log.
# If unspecified, or if specified as null, then the 'Debug' log level will be used.
log_level: 4
# Rule override settings of the format rules.{engine_name}.{rule_name}.{property_name} = {override_value} where:
# {engine_name} is the name of the engine containing the rule that you want to override.
# {rule_name} is the name of the rule that you want to override.
# {property_name} can either be:
# 'severity' - [Optional] The severity level value that you want to use to override the default severity level for the rule
# Possible values: 1 or 'Critical', 2 or 'High', 3 or 'Moderate', 4 or 'Low', 5 or 'Info'
# 'tags' - [Optional] The string array of tag values that you want to use to override the default tags for the rule
# ---- [Example usage]: ---------------------
# rules:
# eslint:
# sort-vars:
# severity: "Info"
# tags: ["Recommended", "Suggestion"]
# -------------------------------------------
rules:
# ======================================================================
# RETIRE-JS ENGINE RULE OVERRIDES
# ======================================================================
retire-js: {} # Remove this empty object {} when you are ready to specify your first rule override
# ======================================================================
# REGEX ENGINE RULE OVERRIDES
# ======================================================================
regex: {} # Remove this empty object {} when you are ready to specify your first rule override
# ======================================================================
# ESLINT ENGINE RULE OVERRIDES
# ======================================================================
eslint:
sort-imports:
severity: "Critical"
tags: [ "Recommended", "Suggestion" ]
# ======================================================================
# FLOW ENGINE RULE OVERRIDES
# ======================================================================
flow: {} # Remove this empty object {} when you are ready to specify your first rule override
# ======================================================================
# PMD ENGINE RULE OVERRIDES
# ======================================================================
pmd: {} # Remove this empty object {} when you are ready to specify your first rule override
# ======================================================================
# CPD ENGINE RULE OVERRIDES
# ======================================================================
cpd: {} # Remove this empty object {} when you are ready to specify your first rule override
# ======================================================================
# SFGE ENGINE RULE OVERRIDES
# ======================================================================
sfge: {} # Remove this empty object {} when you are ready to specify your first rule override
# Engine specific custom configuration settings of the format engines.{engine_name}.{property_name} = {value} where:
# {engine_name} is the name of the engine containing the setting that you want to override.
# {property_name} is the name of a property that you would like to override.
# Each engine may have its own set of properties available to help customize that particular engine's behavior.
engines:
# ======================================================================
# RETIRE-JS ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-retire-js.html#retirejs-configuration-reference
# ======================================================================
retire-js:
# Whether to turn off the 'retire-js' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# ======================================================================
# REGEX ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-regex.html#regex-configuration-reference
# ======================================================================
regex:
# Whether to turn off the 'regex' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Custom rules to be added to the 'regex' engine of the format custom_rules.{rule_name}.{rule_property_name} = {value} where:
# {rule_name} is the name you would like to give to your custom rule
# {rule_property_name} is the name of one of the rule properties. You may specify the following rule properties:
# 'regex' - The regular expression that triggers a violation when matched against the contents of a file.
# 'file_extensions' - The extensions of the files that you would like to test the regular expression against.
# 'description' - A description of the rule's purpose
# 'violation_message' - [Optional] The message emitted when a rule violation occurs.
# This message is intended to help the user understand the violation.
# Default: 'A match of the regular expression {regex} was found for rule {rule_name}: {description}'
# 'severity' - [Optional] The severity level to apply to this rule by default.
# Possible values: 1 or 'Critical', 2 or 'High', 3 or 'Moderate', 4 or 'Low', 5 or 'Info'
# Default: 3
# 'tags' - [Optional] The string array of tag values to apply to this rule by default.
# Default: ['Recommended']
# ---- [Example usage]: ---------------------
# engines:
# regex:
# custom_rules:
# "NoTodoComments":
# regex: /\/\/[ \t]*TODO/gi
# file_extensions: [".apex", ".cls", ".trigger"]
# description: "Prevents TODO comments from being in apex code."
# violation_message: "A comment with a TODO statement was found. Please remove TODO statements from your apex code."
# severity: "Info"
# tags: ["TechDebt"]
# -------------------------------------------
custom_rules:
NoTodoComments:
regex: /Todo/gi
file_extensions: [ ".apex", ".cls", ".trigger" ]
description: "Prevents TODO comments from being in apex code."
violation_message: "A comment with a TODO statement was found. Please remove TODO statements from your apex code."
severity: "Critical"
tags: [ "Recommended", "Suggestion" ]
# ======================================================================
# ESLINT ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-eslint.html#eslint-configuration-reference
# ======================================================================
eslint:
# Whether to turn off the 'eslint' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Your project's main ESLint configuration file. May be an absolute path or a path relative to the config_root.
# If null and auto_discover_eslint_config is true, then Code Analyzer will attempt to discover/apply it automatically.
# We currently support both flat and legacy ESLint configuration files, but will be removing support for legacy eslintrc
# ESLint configuration files in the coming months.
# See https://eslint.org/docs/latest/use/configure/configuration-files to learn more.
eslint_config_file: null
# Your project's legacy ".eslintignore" file. May be an absolute path or a path relative to the config_root.
# If null and auto_discover_eslint_config is true, then Code Analyzer will attempt to discover/apply it automatically.
# Legacy ".eslintignore" files are currently only supported with ESLint v8 when used alongside of legacy ESLint configuration
# files. We will be removing support for ESLint v8 and this field in the coming months. Therefore, we recommend that you instead
# supply the files that you wish to ignore within a flat ESLint configuration file, specified by the eslint_config_file field.
# See https://eslint.org/docs/latest/use/configure/ignore to learn more.
eslint_ignore_file: null
# Whether to have Code Analyzer automatically discover/apply any ESLint configuration and ignore files from your workspace.
auto_discover_eslint_config: false
# Whether to turn off the default base configuration that supplies the standard ESLint rules for JavaScript files.
# The base configuration for JavaScript files adds the rules from the "eslint:all" configuration to Code Analyzer.
# See https://eslint.org/docs/latest/rules for the list of rules.
disable_javascript_base_config: false
# Whether to turn off the default base configuration that supplies the LWC rules for JavaScript files.
# The base configuration for LWC adds the rules from the "@salesforce/eslint-config-lwc/recommended"
# and "plugin:@lwc/lwc-platform/recommended" configurations to Code Analyzer.
# See https://github.com/salesforce/eslint-config-lwc and https://www.npmjs.com/package/@lwc/eslint-plugin-lwc-platform.
disable_lwc_base_config: false
# Whether to turn off the default base configuration that supplies the standard rules for TypeScript files
# The base configuration for TypeScript files adds the rules from the "plugin:@typescript-eslint:all" configuration to Code Analyzer.
# See https://typescript-eslint.io/rules and https://eslint.org/docs/latest/rules for the lists of rules.
disable_typescript_base_config: false
# Extensions of the files in your workspace that will be used to discover rules.
# To associate file extensions to the standard ESLint JavaScript rules, LWC rules, or custom JavaScript-based
# rules, add them under the 'javascript' language. To associate file extensions to the standard TypeScript
# rules or custom TypeScript-based rules, add them under the 'typescript' language. To allow for the
# discovery of custom rules that are associated with any other language, then add the associated file
# extensions under the 'other' language.
file_extensions:
javascript:
- .js
- .cjs
- .mjs
typescript:
- .ts
other: []
# ======================================================================
# FLOW SCANNER ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-flow.html#flow-scanner-configuration-reference
# ======================================================================
flow:
# Whether to turn off the 'flow' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Indicates the specific Python command to use for the 'Flow Scanner' engine.
# May be provided as the name of a command that exists on the path, or an absolute file path location.
# If unspecified, or specified as null, then an attempt will be made to automatically discover a Python command from your environment.
python_command: null # Last calculated by the config command as: "python3"
# ======================================================================
# PMD ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-pmd.html#pmd-configuration-reference
# ======================================================================
pmd:
# Whether to turn off the 'pmd' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Indicates the specific 'java' command associated with the JRE or JDK to use for the 'pmd' engine.
# May be provided as the name of a command that exists on the path, or an absolute file path location.
# If unspecified, or specified as null, then an attempt will be made to automatically discover a 'java' command from your environment.
java_command: null # Last calculated by the config command as: "java"
# Specifies the list of file extensions to associate to each rule language.
# The rule(s) associated with a given language will run against all the files in your workspace containing one of
# the specified file extensions. Each file extension can only be associated to one language. If a specific language
# is not specified, then a set of default file extensions for that language will be used.
file_extensions:
apex:
- .cls
- .trigger
html:
- .html
- .htm
- .xhtml
- .xht
- .shtml
- .cmp
javascript:
- .js
- .cjs
- .mjs
typescript:
- .ts
visualforce:
- .page
- .component
xml:
- .xml
# List of jar files and/or folders to add the Java classpath when running PMD.
# Each entry may be given as an absolute path or a relative path to 'config_root'.
# This field is primarily used to supply custom Java based rule definitions to PMD.
# See https://pmd.github.io/pmd/pmd_userdocs_extending_writing_java_rules.html
java_classpath_entries: []
# List of xml ruleset files containing custom PMD rules to be made available for rule selection.
# Each ruleset must be an xml file that is either:
# - on disk (provided as an absolute path or a relative path to 'config_root')
# - or a relative resource found on the Java classpath.
# Not all custom rules can be fully defined within an xml ruleset file. For example, Java based rules may be defined in jar files.
# In these cases, you will need to also add your additional files to the Java classpath using the 'java_classpath_entries' field.
# See https://pmd.github.io/pmd/pmd_userdocs_making_rulesets.html to learn more about PMD rulesets.
custom_rulesets: []
# ======================================================================
# CPD ENGINE CONFIGURATION
# To learn more about this configuration, visit:
# https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/engine-cpd.html#cpd-configuration-reference
# ======================================================================
cpd:
# Whether to turn off the 'cpd' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Indicates the specific 'java' command associated with the JRE or JDK to use for the 'cpd' engine.
# May be provided as the name of a command that exists on the path, or an absolute file path location.
# If unspecified, or specified as null, then an attempt will be made to automatically discover a 'java' command from your environment.
java_command: null # Last calculated by the config command as: "java"
# Specifies the list of file extensions to associate to each rule language.
# The rule(s) associated with a given language will run against all the files in your workspace containing one of
# the specified file extensions. Each file extension can only be associated to one language. If a specific language
# is not specified, then a set of default file extensions for that language will be used.
file_extensions:
apex:
- .cls
- .trigger
html:
- .html
- .htm
- .xhtml
- .xht
- .shtml
- .cmp
javascript:
- .js
- .cjs
- .mjs
typescript:
- .ts
visualforce:
- .page
- .component
xml:
- .xml
# Specifies the minimum tokens threshold for each rule language.
# The minimum tokens threshold is the number of tokens required to be in a duplicate block of code in order to be
# reported as a violation. The concept of a token may be defined differently per language, but in general it is a
# distinct basic element of source code. For example, this could be language specific keywords, identifiers,
# operators, literals, and more. See https://docs.pmd-code.org/latest/pmd_userdocs_cpd.html to learn more.
# If a value for a language is unspecified, then the default value of 100 will be used for that language.
minimum_tokens:
apex: 100
html: 100
javascript: 100
typescript: 100
visualforce: 100
xml: 100
# Indicates whether to ignore multiple copies of files of the same name and length.
skip_duplicate_files: false
# ======================================================================
# SFGE ENGINE CONFIGURATION
# This engine is in Developer Preview and is subject to change.
# To learn more about this configuration, visit:
# [PLACEHOLDER LINK]
# ======================================================================
sfge:
# Whether to turn off the 'sfge' engine so that it is not included when running Code Analyzer commands.
disable_engine: false
# Whether to prevent 'sfge' from throwing LimitReached violations for complex paths.
# By default, Salesforce Graph Engine attempts to detect complex paths that might cause OutOfMemory errors,
# and throws LimitReached violations for these paths to continue evaluating other paths safely. The allowed
# complexity is dynamically calculated based on the max Java heap size available, but in some cases you may
# desire to disable this check in addition to increasing java_max_heap_size.
disable_limit_reached_violations: false
# Indicates the specific 'java' command associated with the JRE or JDK to use for the 'sfge' engine.
# May be provided as the name of a command that exists on the path, or an absolute file path location.
# If unspecified, or specified as null, then an attempt will be made to automatically discover a 'java' command from your environment.
java_command: null # Last calculated by the config command as: "java"
# Specifies the maximum size (in bytes) of the Java heap. The specified value is appended to the '-Xmx' Java
# command option. The value must be a multiple of 1024, and greater than 2MB. Append the letters 'k', 'K', 'kb',
# or 'KB' to indicate kilobytes, 'm', 'M', 'mb', or 'MB' to indicate megabytes, and 'g', 'G', 'gb', or 'GB' to
# indicate gigabytes. If unspecified, or specified as null, then the JVM will dynamically choose a default value
# at runtime based on system configuration.
java_max_heap_size: null
# Specifies the number of Java threads available for parallel execution. Increasing the thread count allows for
# Salesforce Graph Engine to evaluate more paths at the same time.
java_thread_count: 4
# Specifies the maximum time (in milliseconds) a specific Java thread may execute before Salesforce Graph Engine
# issues a Timeout violation.
java_thread_timeout: 900000
# ======================================================================
# END OF CODE ANALYZER CONFIGURATION
# ======================================================================