The Todo Checker plugin looks for the pattern (?i)(TODO|FIXME)\\s+($jiraProject-\\d+) (e.g. "TODO MYPROJECT-123: some
comment") in text files. If any of the referenced Jira issues are resolved, it will report the file together with the
issue owner or reporter. There should be no TODO markers in the source code for resolved issues.
Update settings.gradle.kts to include Atlassian dependency:
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://packages.atlassian.com/mvn/maven-external/")
}
}
}Configure Todo Checker in build.gradle.kts:
plugins {
id("ch.ergon.todochecker") version "1.1.0"
}
todoChecker {
jiraUrl.set(URI.create("https://jira.mycompany.com"))
jiraUsername.set(providers.environmentVariable("TODOCHECKER_USERNAME"))
jiraPassword.set(providers.environmentVariable("TODOCHECKER_PASSWORD"))
jiraProject.set("MYPROJECT")
}If you are using Spring Dependency Management, you might need to pin the versions of the Todo Checker plugin dependencies.
In your build.gradle.kts file add the following:
configurations.matching { it.name == "jira" }.configureEach {
resolutionStrategy {
eachDependency {
if (requested.group == "jakarta.ws.rs" && requested.name == "jakarta.ws.rs-api") {
useVersion("2.1.6")
because("TodoChecker-dependency needs javax.ws.rs namespace")
}
if (requested.group.startsWith("org.glassfish.jersey")) {
useVersion("2.35")
because("TodoChecker-dependency needs Jersey 2.x compatible with javax.ws.rs")
}
}
}
}./gradlew checkTodoYou can use the following options to configure the plugin.
| Parameter | Default value | Required | Description |
|---|---|---|---|
| directory | project directory | no | The directory to scan for TODO markers. |
| exclusions | empty list | no | A file containing a Java Glob per line for files that the plugin should NOT scan. |
| inclusions | empty list | no | A file containing a Java Glob per line for files that the plugin should always scan. Otherwise, files that don't match will be tested for text content. |
| jiraUrl | - | yes | The Jira URL. |
| jiraUsername | - | no | The username to connect to Jira (use this OR jiraPersonalAccessToken). May also be passed as gradle property, e.g. set in gradle.properties. |
| jiraPassword | - | no | The password to connect to Jira (use this OR jiraPersonalAccessToken). May also be passed as gradle property, e.g. set in gradle.properties. |
| jiraPersonalAccessToken | - | no | Personal access token (may be used instead of username+password). May also be passed as gradle property, e.g. set in gradle.properties. |
| jiraProject | - | yes | The Jira project key to match TODO markers. |
| jiraResolvedStatuses | "Done" status category | no | A list of statuses in which an issue is considered resolved. If not set, all issues that have a "Done" status category are considered resolved. |
| todoRegex | (?i)(TODO|FIXME)\s+(?<ticket>$jiraProject-\d+) |
no | The regex used for searching TODOs and recognizing associated JIRA tickets. Must contain a named capture group "ticket" which is used to extract the matched JIRA ticket. |
| failOnResolvedTodos | false | no | Whether to fail the build if any TODO markers are found for resolved Jira issues. |
An exclusion file looks as follows.
**/.gradle/**
.git/**
.idea/**
**/node_modules/**
**/build/**
An inclusion file could look like this.
**.java
**.jsp
**.js
**.kt
**.kts
**.ts
**.gradle
**.properties
**.xml
**.go
Todo Checker is released under the MIT License.