Configuration - .deepsource.toml

This section covers configuration details specific to the Java analyzer. Please ensure that you have read the general configuration guide first.

The Java analyzer supports Gradle, Maven and Bazel projects. There is no difference in configuration between them, and all types of projects can be initialized through the simple workflow of the DeepSource configuration generator.

name

  • Type: String
  • Presence: mandatory
  • Description: Shortcode of the analyzer.
  • Example:
name = "java"

enabled

  • Type: Boolean
  • Presence: optional
  • Description: Toggle whether this analyzer should be run.
  • Example:
enabled = true

meta

  • Type: Table
  • Presence: mandatory
  • Description: Additional data used to configure the analyzer.
  • Example:
[analyzers.meta]
  runtime_version = "8"

runtime_version

  • Type: String
  • Presence: mandatory
  • Description: The Java runtime version to use when running the analyzer. OpenJDK versions 8 to 21 are currently supported.
  • Aliases: java_version
  • Example:
[analyzers.meta]
  runtime_version = "13"

πŸ“˜

if runtime_version is not specified, or is the wrong Java version, analysis may show incorrect results. Specify the Java version you use in CI for best results.

skip_doc_coverage

  • Type: Array

  • Presence: optional

  • Description: Specify which artifacts to skip when calculating documentation coverage.

  • Available Values: test, class, constructor and nonpublic

    • test - Ignore documentation coverage within tests
    • class - Ignore class documentation coverage
    • constructor - Ignore constructor documentation coverage
    • nonpublic - Ignore documentation coverage for any declaration not marked as public
  • Default Value: [ "test" ]

  • Example:

skip_doc_coverage = [ "nonpublic", "test" ]

πŸ“˜

If skip_doc_coverage is set, it will override any default configuration. That is, if this key is set, and you wish to ensure documentation coverage is skipped for elements that are skipped by default (like tests), you must specify those as well as the additional elements you wish to skip.

cyclomatic_complexity_threshold

  • Type: String

  • Presence: optional

  • Description: Specify the acceptable risk category for your project as the threshold. All functions with complexity beyond this threshold will raise an issue. For example, setting the threshold to low will flag all functions that have a cyclomatic complexity of more than 5, while setting the threshold to critical will not flag any function.

  • Available Values: low, medium, high, very-high and critical

Risk categoryCyclomatic complexity rangeRecommended action
low1-5No action is needed.
medium6-15Review and monitor.
high16-25Review and refactor. Recommended to add detailed comments if the function absolutely needs to be kept as it is.
very-high26-50Refactor to reduce the complexity.
critical> 50Must refactor this. This can make the code untestable and very difficult to understand.
  • Default Value: medium
  • Example:
[analyzers.meta]
cyclomatic_complexity_threshold = "high"

Sample config

version = 1

[[analyzers]]
name = "java"
enabled = true

  [analyzers.meta]
  runtime_version = "8"