Idea Duplicates
The Duplicates Finder (Java) build runner is intended for catching similar code fragments and providing a report on discovered repetitive blocks of Java code.
Example. Adds a Duplicates Finder (Java) build step with custom JVM setup, default IDEA tool, include/exclude patterns and disabled plugins. This build step will run even if some previous build steps are failed.
buildType {
// Other Build Type settings ...
steps {
// Other Build Steps ...
ideaDuplicates {
name = "My Duplicates step"
executionMode = BuildStep.ExecutionMode.RUN_ON_FAILURE
pathToProject = ""
jdk {
name = "13"
path = "%env.JDK_13_0%"
patterns("jre/lib/*.jar", "jre/lib/ext/jfxrt.jar")
extAnnotationPatterns("%teamcity.tool.idea%/lib/jdkAnnotations.jar")
}
jvmArgs = "-Xmx1G -XX:ReservedCodeCacheSize=512m"
targetJdkHome = "%env.JDK_11%"
ideaAppHome = "%teamcity.tool.intellij.DEFAULT%"
lowerBound = 10
discardCost = 0
distinguishVariables = true
distinguishFields = true
distinguishMethods = true
distinguishTypes = true
distinguishLiterals = true
extractSubexpressions = true
includeTestSources = true
includeExcludePatterns = """
+:pattern1
-:pattern2
""".trimIndent()
disabledPlugins = "disabled_plugin1"
}
Content copied to clipboard }
}
Properties
Optional collection of build step execution conditions
List of identifiers of IntelliJ IDEA disabled plugins. If plugin is disabled it won't be loaded when IntelliJ IDEA starts on the agent. Please refer to ${user.home}/.IntelliJIdea/config/disabled_plugins.txt on the machine where IntelliJ IDEA is installed for an example of such a list.
Ignore duplicate subexpressions with complexity lower than specified
Whether the similar contents with different field names will be recognized as different or such contents will be recognized as duplicated
Whether similar line of code with different literals will be considered different or such lines will be recognized as duplicates.
Whether the methods of similar structure will be recognized as different or such methods will be recognized as duplicated (in this case, they can be extracted and reused).
Whether the similar code fragments with different type names will be recognized as different or such code fragments will be recognized as duplicates.
Whether the similar contents with different variable names will be recognized as different or such contents will be recognized as duplicated.
Build step execution mode
Whether the duplicated subexpressions can be extracted
IntelliJ Inspections and Duplicates Engine Home path
Newline-delimited set or rules in the form of +:|-:pattern
Whether the test sources will be included in the duplicates analysis
Ignore duplicates with complexity simpler than specified
The path to the project file (.ipr) or path to the project directory (root directory of the project that contains .idea directory). The path should be relative to the checkout directory.
The path to your custom JDK used to run the build
Functions
Deletes all configured build step conditions
Configures build step conditions
Copies parameters of this object to the specified target
Validates this object and reports found errors to the provided consumer