fabiolnm/cieloz

View on GitHub
lib/cieloz/helpers.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Method valid? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def valid?
        valid = _valid?
        unless @source.nil?
          unless valid
            errors.messages.each { |attr,attr_errors|
Severity: Minor
Found in lib/cieloz/helpers.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 attrs_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def attrs_from source, opts, *keys
        attrs = keys.map { |k|
          value_or_attr_name = opts[k] || k
          if value_or_attr_name.is_a? Symbol
            source.send value_or_attr_name if source.respond_to? value_or_attr_name
Severity: Minor
Found in lib/cieloz/helpers.rb - About 55 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

Method hattr_writer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def hattr_writer *attrs
        attrs.each { |attr|
          define_method "#{attr}=" do |value|
            if value.is_a? Hash
              name = attr.to_s.camelize
Severity: Minor
Found in lib/cieloz/helpers.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

There are no issues that match your filters.

Category
Status