Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code for unresolved substitution checking appears to be unused #396

Open
cloudshiftchris opened this issue Oct 30, 2023 · 0 comments
Open

Comments

@cloudshiftchris
Copy link

This code in ConfigParser (see HERE comment inline) does not use the results of configuring for unresolved substitution checking.

  fun <A : Any> decode(
    kclass: KClass<A>,
    environment: Environment?,
    resourceOrFiles: List<String>,
    propertySources: List<PropertySource>,
    configSources: List<ConfigSource>,
  ): ConfigResult<A> {

    if (decoderRegistry.size == 0)
      return ConfigFailure.EmptyDecoderRegistry.invalid()

    return loader.loadNodes(propertySources, configSources, resourceOrFiles).flatMap { nodes ->
      cascader.cascade(nodes).flatMap { node ->
        val context = context(node)
        preprocessing.preprocess(node, context).flatMap { preprocessed ->
          check(preprocessed).flatMap {
        
            // HERE ^^^: results of check() (implicit `it` variable in above flatMap) are not used below
            val decoded = decoding.decode(kclass, preprocessed, decodeMode, context)
            val state = createDecodingState(preprocessed, context, secretsPolicy)

            // always do report regardless of decoder result
            if (useReport) {
              Reporter(reportPrintFn, obfuscator, environment)
                .printReport(propertySources, state, context.reporter.getReport())
            }

            decoded
          }
        }
      }
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant