* Sets the {@link #input input} to {@code src/main/kotlin}, {@code src/test/kotlin} and {@code detekt-baseline.xml} * if they exist. * * @param project the project to configure the operation from * @return this operation instance */ @Override public DetektOperation fromProject(BaseProject project) { project_ = project; var main = new File(project.srcMainDirectory(), "kotlin"); if (main.exists()) { input_.add(main.getAbsolutePath()); } var test = new File(project.srcTestDirectory(), "kotlin"); if (test.exists()) { input_.add(test.getAbsolutePath()); } var baseline = new File(project.workDirectory(), "detekt-baseline.xml"); if (baseline.exists()) { baseline_ = baseline.getAbsolutePath(); } return this; } /** * Export default config. Path can be specified with {@link #config config} option. *
* Default path: {@code default-detekt-config.yml}
*
* @param generate {@code true} or {@code false}
* @return this operation instance
*/
public DetektOperation generateConfig(boolean generate) {
generateConfig_ = generate;
return this;
}
/**
* Globbing patterns describing paths to include in the analysis. Useful in
* combination with {@link #excludes(String) excludes} patterns.
*
* @param patterns the patterns
* @return this operation instance
*/
public DetektOperation includes(String patterns) {
includes_ = patterns;
return this;
}
/**
* Input paths to analyze. If not specified the current working directory is used.
*
* @param paths the list of paths
* @return this operation instance
*/
public DetektOperation input(Collection
* Default: 1.8
*
* @param target the target version
* @return this operation instance
*/
public DetektOperation jvmTarget(String target) {
jvmTarget_ = target;
return this;
}
/**
* EXPERIMENTAL: Compatibility mode for Kotlin language version X.Y,
* reports errors for all language features that came out later.
*
* Possible Values: [1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1]
*
* @param version the version
* @return this operation instance
*/
public DetektOperation languageVersion(String version) {
languageVersion_ = version;
return this;
}
/**
* Return exit code 0 only when found issues count does not exceed
* specified issues count.
*
* @param max the issues code
* @return this operation instance
*/
public DetektOperation maxIssues(int max) {
maxIssues_ = max;
return this;
}
/**
* Enables parallel compilation and analysis of source files. Do some
* benchmarks first before enabling this flag. Heuristics show performance
* benefits starting from 2000 lines of Kotlin code.
*
* @param parallel{@code true} or {@code false}
* @return this operation instance
*/
public DetektOperation parallel(boolean parallel) {
parallel_ = parallel;
return this;
}
/**
* Enables parallel compilation and analysis of source files. Do some
* benchmarks first before enabling this flag. Heuristics show performance
* benefits starting from 2000 lines of Kotlin code.
*
* @param jars one or more jars
* @return this operation instance
*/
public DetektOperation plugins(String... jars) {
plugins_.addAll(List.of(jars));
return this;
}
/**
* Enables parallel compilation and analysis of source files. Do some
* benchmarks first before enabling this flag. Heuristics show performance
* benefits starting from 2000 lines of Kotlin code.
*
* @param jars the list of jars
* @return this operation instance
*/
public DetektOperation plugins(Collection