-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathCLI.java
More file actions
681 lines (590 loc) · 23.8 KB
/
CLI.java
File metadata and controls
681 lines (590 loc) · 23.8 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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
package io.codemodder;
import static io.codemodder.Logs.logEnteringPhase;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.OutputStreamAppender;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.javaparser.JavaParser;
import com.google.common.base.Stopwatch;
import io.codemodder.codetf.CodeTFChangesetEntry;
import io.codemodder.codetf.CodeTFReport;
import io.codemodder.codetf.CodeTFReportGenerator;
import io.codemodder.codetf.CodeTFResult;
import io.codemodder.javaparser.JavaParserFacade;
import io.codemodder.javaparser.JavaParserFactory;
import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Provider;
import net.logstash.logback.encoder.LogstashEncoder;
import net.logstash.logback.fieldnames.LogstashCommonFieldNames;
import net.logstash.logback.fieldnames.LogstashFieldNames;
import org.apache.commons.io.FileUtils;
import org.jetbrains.annotations.VisibleForTesting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import picocli.CommandLine;
/** The mixinStandardHelpOptions provides version and help options. */
@CommandLine.Command(
name = "codemodder",
mixinStandardHelpOptions = true,
description = "Run a codemodder codemod")
final class CLI implements Callable<Integer> {
private final List<Class<? extends CodeChanger>> codemodTypes;
private final Clock clock;
private final FileFinder fileFinder;
private final EncodingDetector encodingDetector;
private final JavaParserFactory javaParserFactory;
private final SourceDirectoryLister sourceDirectoryLister;
private final CodeTFReportGenerator reportGenerator;
private final String[] args;
@CommandLine.Option(
names = {"--output"},
description = "the output file to produce")
private File output;
@CommandLine.Option(
names = {"--dry-run"},
description = "do everything except make changes to files",
defaultValue = "false")
private boolean dryRun;
@CommandLine.Option(
names = {"--max-files"},
description = "the number of files each codemod can scan",
defaultValue = "-1")
private int maxFiles;
@CommandLine.Option(
names = {"--max-workers"},
description = "the maximum number of workers (threads) to use for parallel processing",
defaultValue = "-1")
private int maxWorkers;
@CommandLine.Option(
names = {"--max-file-size"},
description = "the maximum file size in bytes that each codemod can scan",
defaultValue = "-1")
private int maxFileSize;
@CommandLine.Option(
names = {"--dont-exit"},
description = "dont exit the process after running the codemods",
hidden = true,
defaultValue = "false")
private boolean dontExit;
@CommandLine.Option(
names = {"--verbose"},
description = "print more to stdout",
defaultValue = "false")
private boolean verbose;
@CommandLine.Option(
names = {"--output-format"},
description = "the format for the data output file (\"codetf\" or \"diff\")",
defaultValue = "codetf")
private OutputFormat outputFormat;
@CommandLine.Option(
names = {"--log-format"},
description = "the format of log data(\"human\" or \"json\")",
defaultValue = "human")
private LogFormat logFormat;
@CommandLine.Option(
names = {"--project-name"},
description = "a descriptive name for the project being scanned for reporting")
private String projectName;
@CommandLine.Option(
names = {"--sonar-json"},
description =
"comma-separated set of path(s) to file(s) containing the result of a call to the Sonar Web API Issues or Hotspots endpoint (or both such files merged together)",
split = ",")
private List<String> sonarJsons;
@CommandLine.Option(
names = {"--defectdojo-findings-json"},
description =
"a path to a file containing the result of a call to the DefectDojo v2 Findings API endpoint")
private Path defectDojoFindingsJsonFilePath;
@CommandLine.Option(
names = {"--contrast-vulnerabilities-xml"},
description =
"a path to a file containing the result of a call to the Contrast Assess XML export API")
private Path contrastVulnerabilitiesXmlFilePath;
@CommandLine.Option(
names = {"--list"},
description = "print codemod(s) metadata, then exit",
defaultValue = "false")
private boolean listCodemods;
@CommandLine.Option(
names = {"--path-include"},
description = "comma-separated set of UNIX glob patterns to include",
split = ",")
private List<String> pathIncludes;
@CommandLine.Option(
names = {"--path-exclude"},
description = "comma-separated set of UNIX glob patterns to exclude",
split = ",")
private List<String> pathExcludes;
@CommandLine.Option(
names = {"--codemod-include"},
description = "comma-separated set of codemod IDs to include",
split = ",")
private List<String> codemodIncludes;
@CommandLine.Option(
names = {"--parameter"},
description = "a codemod parameter")
private List<String> codemodParameters;
@CommandLine.Option(
names = {"--codemod-exclude"},
description = "comma-separated set of codemod IDs to exclude",
split = ",")
private List<String> codemodExcludes;
@CommandLine.Parameters(
arity = "0..1",
paramLabel = "DIRECTORY",
description = "the directory to run the codemod on")
private File projectDirectory;
@CommandLine.Option(
names = {"--sarif"},
description = "comma-separated set of path(s) to SARIF file(s) to feed to the codemods",
split = ",")
private List<String> sarifs;
private final DryRunTempDirCreationStrategy dryRunTempDirCreationStrategy;
/** The format for the output file. */
enum OutputFormat {
CODETF,
DIFF
}
/** The format for the log output. */
enum LogFormat {
HUMAN,
JSON
}
CLI(final String[] args, final List<Class<? extends CodeChanger>> codemodTypes) {
this(
args,
codemodTypes,
Clock.systemUTC(),
new DefaultFileFinder(),
new DefaultEncodingDetector(),
JavaParserFactory.newFactory(),
SourceDirectoryLister.createDefault(),
CodeTFReportGenerator.createDefault(),
new DefaultDryRunTempDirCreationStrategy());
}
CLI(
final String[] args,
final List<Class<? extends CodeChanger>> codemodTypes,
final Clock clock,
final FileFinder fileFinder,
final EncodingDetector encodingDetector,
final JavaParserFactory javaParserFactory,
final SourceDirectoryLister sourceDirectoryLister,
final CodeTFReportGenerator reportGenerator,
final DryRunTempDirCreationStrategy dryRunTempDirCreationStrategy) {
Objects.requireNonNull(codemodTypes);
this.codemodTypes = Collections.unmodifiableList(codemodTypes);
this.clock = Objects.requireNonNull(clock);
this.fileFinder = Objects.requireNonNull(fileFinder);
this.encodingDetector = Objects.requireNonNull(encodingDetector);
this.javaParserFactory = Objects.requireNonNull(javaParserFactory);
this.sourceDirectoryLister = Objects.requireNonNull(sourceDirectoryLister);
this.reportGenerator = Objects.requireNonNull(reportGenerator);
this.args = Objects.requireNonNull(args);
this.dryRunTempDirCreationStrategy = Objects.requireNonNull(dryRunTempDirCreationStrategy);
}
@VisibleForTesting
static class DefaultFileFinder implements FileFinder {
@Override
public List<Path> findFiles(final Path projectDir, final IncludesExcludes includesExcludes) {
final List<Path> allFiles;
try (Stream<Path> paths = Files.walk(projectDir)) {
allFiles =
paths
.filter(Files::isRegularFile)
.filter(
p -> !Files.isSymbolicLink(p)) // could cause infinite loop if we follow links
.filter(p -> includesExcludes.shouldInspect(p.toFile()))
.sorted()
.toList();
} catch (IOException e) {
throw new UncheckedIOException(e);
}
return allFiles;
}
}
/** A seam responsible for creating a temp directory for the dry-run feature. */
@VisibleForTesting
interface DryRunTempDirCreationStrategy {
Path createTempDir() throws IOException;
}
private static class DefaultDryRunTempDirCreationStrategy
implements DryRunTempDirCreationStrategy {
@Override
public Path createTempDir() throws IOException {
return Files.createTempDirectory("codemodder-project");
}
}
@Override
public Integer call() throws IOException {
if (verbose) {
setupVerboseLogging();
}
if (LogFormat.JSON.equals(logFormat)) {
setupJsonLogging();
}
if (listCodemods) {
for (Class<? extends CodeChanger> codemodType : codemodTypes) {
Codemod annotation = codemodType.getAnnotation(Codemod.class);
log.info(annotation.id());
}
return SUCCESS;
}
logEnteringPhase(Logs.ExecutionPhase.STARTING);
log.info("codemodder: java/{}", CLI.class.getPackage().getImplementationVersion());
if (projectDirectory == null) {
log.error("No project directory specified");
return ERROR_CANT_READ_PROJECT_DIRECTORY;
}
Path outputPath = null;
if (output != null) {
outputPath = output.getAbsoluteFile().toPath();
// check if the output file parent directory doesn't exist or isn't writable
if (!Files.exists(outputPath.getParent()) || !Files.isWritable(outputPath.getParent())) {
log.error("The output file parent directory doesn't exist or isn't writable");
return ERROR_CANT_WRITE_OUTPUT_FILE;
}
}
Path projectPath = projectDirectory.toPath();
if (!Files.isDirectory(projectPath) || !Files.isReadable(projectPath)) {
log.error("The project directory is not a readable directory");
return ERROR_CANT_READ_PROJECT_DIRECTORY;
}
if (maxWorkers < -1) {
log.error("Invalid value for workers");
return -1;
}
logEnteringPhase(Logs.ExecutionPhase.SETUP);
if (dryRun) {
// create a temp dir and copy all the contents into it -- this may be slow for big repos on
// cloud i/o
Path copiedProjectDirectory = dryRunTempDirCreationStrategy.createTempDir();
Stopwatch watch = Stopwatch.createStarted();
log.debug("dry run temporary directory: {}", copiedProjectDirectory);
FileUtils.copyDirectory(projectDirectory, copiedProjectDirectory.toFile());
watch.stop();
Duration elapsed = watch.elapsed();
log.debug("dry run copy finished: {}ms", elapsed.toMillis());
// now that we've copied it, reassign the project directory to that place
projectDirectory = copiedProjectDirectory.toFile();
projectPath = copiedProjectDirectory;
}
try {
Instant start = clock.instant();
// get path includes/excludes
List<String> pathIncludes = this.pathIncludes;
List<String> pathExcludes = this.pathExcludes;
// If no path includes/excludes were specified, relegate filtering to each codemod
boolean useGlobalIncludesExcludes = pathIncludes != null || pathExcludes != null;
IncludesExcludes includesExcludes = IncludesExcludes.any();
if (pathIncludes == null) {
pathIncludes = List.of("**");
}
if (pathExcludes == null) {
pathExcludes = List.of();
}
if (useGlobalIncludesExcludes) {
includesExcludes =
IncludesExcludes.withSettings(projectDirectory, pathIncludes, pathExcludes);
}
log.debug("including paths: {}", pathIncludes);
log.debug("excluding paths: {}", pathExcludes);
// get all files that match
log.trace("Listing source directories");
List<SourceDirectory> sourceDirectories =
sourceDirectoryLister.listJavaSourceDirectories(List.of(projectDirectory));
log.trace("Listing files");
List<Path> filePaths = fileFinder.findFiles(projectPath, includesExcludes);
log.trace("Creating codemod regulator");
// get codemod includes/excludes
final CodemodRegulator regulator;
if (codemodIncludes != null && codemodExcludes != null) {
log.error("Codemod includes and excludes cannot both be specified");
return ERROR_INVALID_ARGUMENT;
} else if (codemodIncludes == null && codemodExcludes == null) {
// the user didn't pass any includes, which means all are enabled
regulator = CodemodRegulator.of(DefaultRuleSetting.ENABLED, List.of());
} else if (codemodIncludes != null) {
regulator = CodemodRegulator.of(DefaultRuleSetting.DISABLED, codemodIncludes);
} else {
// the user only specified excludes
regulator = CodemodRegulator.of(DefaultRuleSetting.ENABLED, codemodExcludes);
}
// create the loader
log.debug("Loading input files");
CodeDirectory codeDirectory = new DefaultCodeDirectory(projectPath);
List<Path> sarifFiles = convertToPaths(sarifs);
List<Path> sonarJsonFiles = convertToPaths(sonarJsons);
log.debug("Parsing SARIFs");
Map<String, List<RuleSarif>> pathSarifMap =
SarifParser.create().parseIntoMap(sarifFiles, codeDirectory);
List<ParameterArgument> codemodParameters =
createFromParameterStrings(this.codemodParameters);
CodemodLoader loader =
new CodemodLoader(
codemodTypes,
regulator,
projectPath,
pathIncludes,
pathExcludes,
filePaths,
pathSarifMap,
codemodParameters,
sonarJsonFiles,
defectDojoFindingsJsonFilePath,
contrastVulnerabilitiesXmlFilePath);
List<CodemodIdPair> codemods = loader.getCodemods();
log.debug("sarif files: {}", sarifFiles.size());
// create the project providers
List<ProjectProvider> projectProviders = loadProjectProviders();
List<CodeTFProvider> codeTFProviders = loadCodeTFProviders();
List<CodeTFResult> results = new ArrayList<>();
/*
* Run the codemods on the files. Note that we cache the compilation units so that we're always retaining
* the original concrete syntax information (e.g., line numbers) in JavaParser from the first access. This
* is what allows our codemods to act on SARIF-providing tools data accurately over multiple codemods.
*/
logEnteringPhase(Logs.ExecutionPhase.SCANNING);
Provider<JavaParser> javaParserProvider =
() -> {
try {
return javaParserFactory.create(sourceDirectories);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
};
JavaParserFacade javaParserFacade = JavaParserFacade.from(javaParserProvider);
int maxFileCacheSize = 10_000;
FileCache fileCache = FileCache.createDefault(maxFileCacheSize);
for (CodemodIdPair codemod : codemods) {
CodemodExecutor codemodExecutor;
if (useGlobalIncludesExcludes) {
codemodExecutor =
new DefaultCodemodExecutor(
projectPath,
includesExcludes,
codemod,
projectProviders,
codeTFProviders,
fileCache,
javaParserFacade,
encodingDetector,
maxFileSize,
maxFiles,
maxWorkers);
} else {
codemodExecutor =
new DefaultCodemodExecutor(
projectPath,
codemod,
projectProviders,
codeTFProviders,
fileCache,
javaParserFacade,
encodingDetector,
maxFileSize,
maxFiles,
maxWorkers);
}
log.info("running codemod: {}", codemod.getId());
CodeTFResult result = codemodExecutor.execute(filePaths);
results.add(result);
if (!result.getChangeset().isEmpty()) {
log.info("changed:");
result
.getChangeset()
.forEach(
entry -> {
log.info(" - " + entry.getPath());
String indentedDiff =
entry
.getDiff()
.lines()
.map(line -> " " + line)
.collect(Collectors.joining(System.lineSeparator()));
log.debug(" diff:");
log.debug(indentedDiff);
});
}
if (!result.getFailedFiles().isEmpty()) {
log.info("failed:");
result.getFailedFiles().forEach(f -> log.info(" - {}", f));
}
}
Instant end = clock.instant();
long elapsed = end.toEpochMilli() - start.toEpochMilli();
logEnteringPhase(Logs.ExecutionPhase.REPORT);
logMetrics(results);
// write out the output if they want it
if (outputPath != null) {
if (OutputFormat.CODETF.equals(outputFormat)) {
CodeTFReport report =
reportGenerator.createReport(
projectDirectory.toPath(),
String.join(" ", args),
sarifs == null ? List.of() : sarifs.stream().map(Path::of).toList(),
results,
elapsed);
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Files.writeString(outputPath, mapper.writeValueAsString(report));
log.debug("report file: {}", outputPath);
} else if (OutputFormat.DIFF.equals(outputFormat)) {
throw new UnsupportedOperationException("not supported yet");
}
}
log.debug("elapsed: {}ms", elapsed);
// this is a special exit code that tells the caller to not exit
if (dontExit) {
return -1;
}
return SUCCESS;
} finally {
if (dryRun) {
// delete the temp directory
FileUtils.deleteDirectory(projectDirectory);
log.debug("cleaned temp directory: {}", projectDirectory);
}
}
}
private List<Path> convertToPaths(final List<String> pathsStr) {
return pathsStr != null ? pathsStr.stream().map(Path::of).toList() : List.of();
}
/**
* Performs a resetting of the logging settings because they're wildly different if we do
* structured logging.
*/
private void setupJsonLogging() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
ch.qos.logback.classic.Logger rootLogger =
context.getLogger(LoggingConfigurator.OUR_ROOT_LOGGER_NAME);
rootLogger.detachAndStopAllAppenders();
ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<>();
appender.setContext(context);
configureAppender(appender, Optional.ofNullable(projectName));
rootLogger.addAppender(appender);
}
/**
* This code is difficult to test because it affects stdout at runtime, and JUnit appears to be
* mucking with stdout capture.
*/
@VisibleForTesting
static void configureAppender(
final OutputStreamAppender<ILoggingEvent> appender, final Optional<String> projectName) {
LogstashEncoder logstashEncoder = new LogstashEncoder();
logstashEncoder.setContext(appender.getContext());
// we need this to get the caller data, like the file, line, etc.
logstashEncoder.setIncludeCallerData(true);
// customize the output to the specification, but include timestamp as well since that's allowed
LogstashFieldNames fieldNames = logstashEncoder.getFieldNames();
fieldNames.setCallerFile("file");
fieldNames.setCallerLine("line");
fieldNames.setTimestamp("timestamp");
fieldNames.setCaller(null);
fieldNames.setCallerClass(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
fieldNames.setCallerMethod(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
fieldNames.setVersion(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
fieldNames.setLogger(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
fieldNames.setThread(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
fieldNames.setLevelValue(LogstashCommonFieldNames.IGNORE_FIELD_INDICATOR);
String projectNameKey = "project_name";
if (projectName.isPresent()) {
MDC.put(projectNameKey, projectName.get());
} else {
// clear it in case this from tests
MDC.remove(projectNameKey);
}
logstashEncoder.addIncludeMdcKeyName(projectNameKey);
logstashEncoder.start();
appender.setEncoder(logstashEncoder);
appender.start();
}
private void setupVerboseLogging() {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
ch.qos.logback.classic.Logger rootLogger =
context.getLogger(LoggingConfigurator.OUR_ROOT_LOGGER_NAME);
rootLogger.setLevel(Level.DEBUG);
}
private static void logMetrics(final List<CodeTFResult> results) {
List<String> failedFiles = results.stream().flatMap(r -> r.getFailedFiles().stream()).toList();
List<String> changedFiles =
results.stream()
.flatMap(r -> r.getChangeset().stream())
.map(CodeTFChangesetEntry::getPath)
.toList();
long uniqueChangedFiles = changedFiles.stream().distinct().count();
long uniqueFailedFiles = failedFiles.stream().distinct().count();
log.debug("failed files: {} ({} unique)", failedFiles.size(), uniqueFailedFiles);
log.debug("changed files: {} ({} unique)", changedFiles.size(), uniqueChangedFiles);
}
private List<CodeTFProvider> loadCodeTFProviders() {
List<CodeTFProvider> codeTFProviders = new ArrayList<>();
ServiceLoader<CodeTFProvider> loader = ServiceLoader.load(CodeTFProvider.class);
for (CodeTFProvider provider : loader) {
codeTFProviders.add(provider);
}
return codeTFProviders;
}
private List<ProjectProvider> loadProjectProviders() {
List<ProjectProvider> projectProviders = new ArrayList<>();
ServiceLoader<ProjectProvider> loader = ServiceLoader.load(ProjectProvider.class);
for (ProjectProvider projectProvider : loader) {
projectProviders.add(projectProvider);
}
return projectProviders;
}
/**
* Translate the codemod parameters delivered as CLI arguments in the form of LDAP-style
* name=value pairs into their POJO form.
*/
private List<ParameterArgument> createFromParameterStrings(final List<String> parameterStrings) {
if (parameterStrings == null || parameterStrings.isEmpty()) {
return List.of();
}
return parameterStrings.stream().map(ParameterArgument::fromNameValuePairs).toList();
}
private static final int SUCCESS = 0;
private static final int ERROR_CANT_READ_PROJECT_DIRECTORY = 1;
private static final int ERROR_CANT_WRITE_OUTPUT_FILE = 2;
private static final int ERROR_INVALID_ARGUMENT = 3;
private static final List<String> defaultPathIncludes =
List.of(
"**.java",
"**/*.java",
"pom.xml",
"**/pom.xml",
"**.jsp",
"**/*.jsp",
"web.xml",
"**/web.xml",
".github/workflows/*.yml",
".github/workflows/*.yaml");
private static final List<String> defaultPathExcludes =
List.of(
"**/test/**",
"**/testFixtures/**",
"**/*Test.java",
"**/intTest/**",
"**/tests/**",
"**/target/**",
"**/build/**",
"**/.mvn/**",
".mvn/**");
private static final Logger log = LoggerFactory.getLogger(CLI.class);
}