pambrose/prometheus-proxy

View on GitHub

Showing 4 of 30 total issues

Method assignConfigVals has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
Open

  override fun assignConfigVals() {
    with(configVals.proxy) {
      if (proxyHttpPort == -1)
        proxyHttpPort = PROXY_PORT.getEnv(http.port)
      logger.info { "proxyHttpPort: $proxyHttpPort" }
Severity: Minor
Found in src/main/kotlin/io/prometheus/proxy/ProxyOptions.kt - About 5 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method assignConfigVals has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  override fun assignConfigVals() {
    with(configVals.proxy) {
      if (proxyHttpPort == -1)
        proxyHttpPort = PROXY_PORT.getEnv(http.port)
      logger.info { "proxyHttpPort: $proxyHttpPort" }
Severity: Minor
Found in src/main/kotlin/io/prometheus/proxy/ProxyOptions.kt - About 1 hr to fix

    Method metricsConfigTest has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      @Test
      fun metricsConfigTest() {
        newMetricsConfig(true, 555, configVals("agent.metrics.enabled=true").agent.metrics)
          .also {
            it.enabled.shouldBeTrue()
    Severity: Minor
    Found in src/test/kotlin/io/prometheus/DataClassTest.kt - About 1 hr to fix

      Method adminConfigTest has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        @Test
        fun adminConfigTest() {
          var vals = configVals("agent.admin.enabled=true")
          newAdminConfig(vals.agent.admin.enabled, -1, vals.agent.admin)
            .also {
      Severity: Minor
      Found in src/test/kotlin/io/prometheus/DataClassTest.kt - About 1 hr to fix
        Severity
        Category
        Status
        Source
        Language