dry-rb/dry-configurable

View on GitHub

Showing 3 of 35 total issues

Method define_accessors! has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def define_accessors!
          @lock.synchronize do
            break if config_defined?

            settings.each do |setting|
Severity: Minor
Found in lib/dry/configurable/config.rb - About 1 hr 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 call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def call(val, opts, block)
          if block && block.parameters.empty?
            raise ArgumentError unless Undefined.equal?(opts)

            processor = DEFAULT_PROCESSOR
Severity: Minor
Found in lib/dry/configurable/settings/argument_parser.rb - About 1 hr 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 set_values! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_values!(parent)
        self.class.settings.each do |setting|
          if parent.key?(setting.name) && !setting.node?
            @config[setting.name] = parent[setting.name]
          elsif setting.undefined?
Severity: Minor
Found in lib/dry/configurable/config.rb - 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

Severity
Category
Status
Source
Language