cloudfoundry/stratos

View on GitHub
src/jetstream/repository/interfaces/config/config.go

Summary

Maintainability
A
25 mins
Test Coverage

Function SetStructFieldValue has 57 lines of code (exceeds 50 allowed). Consider refactoring.
Wontfix

func SetStructFieldValue(value reflect.Value, field reflect.Value, val string) error {

    var newVal interface{}
    var err error
    typ := field.Type()
Severity: Minor
Found in src/jetstream/repository/interfaces/config/config.go - About 1 hr to fix

    Function SetStructFieldValue has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Wontfix

    func SetStructFieldValue(value reflect.Value, field reflect.Value, val string) error {
    
        var newVal interface{}
        var err error
        typ := field.Type()
    Severity: Minor
    Found in src/jetstream/repository/interfaces/config/config.go - About 45 mins 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

    Function NewConfigFileLookup has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
    Open

    func NewConfigFileLookup(path string) env.Lookup {
    
        // Check if the config file exists
        if _, err := os.Stat(path); err != nil {
            return env.NoopLookup
    Severity: Minor
    Found in src/jetstream/repository/interfaces/config/config.go - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status