openxml/openxml-package

View on GitHub

Showing 3 of 3 total issues

Method attribute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

      def attribute(name, expects: nil, one_of: nil, in_range: nil, displays_as: nil, namespace: nil, matches: nil, validation: nil, required: false, deprecated: false)
        raise ArgumentError if RESERVED_NAMES.member? name.to_s

        required_attributes.push(name) if required

Severity: Minor
Found in lib/openxml/has_attributes.rb - About 2 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 value_property has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def value_property(name, as: nil, klass: nil, required: false, default_value: nil)
        attr_reader name

        properties[name] = (as || name).to_s
        required_properties[name] = default_value if required
Severity: Minor
Found in lib/openxml/has_properties.rb - 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

Method property has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def property(name, as: nil, klass: nil, required: false)
        properties[name] = (as || name).to_s
        required_properties[name] = true if required
        classified_name = properties[name].split("_").map(&:capitalize).join
        class_name = klass.to_s unless klass.nil?
Severity: Minor
Found in lib/openxml/has_properties.rb - 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

Severity
Category
Status
Source
Language