EditLLC/ruby-montage

View on GitHub

Showing 4 of 4 total issues

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

    def initialize
      @api_version = 1
      @environment ||= "production"
      yield(self) if block_given?
      fail MissingAttributeError, "You must declare the domain attribute" unless @domain
Severity: Minor
Found in lib/montage/client.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 parse_items has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_items
      if attributes.is_a?(Hash)
        {}.tap do |hsh|
          attributes.each do |key, value|
            if key == "_meta"
Severity: Minor
Found in lib/montage/resource.rb - About 35 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 clause_valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def clause_valid?
      if @clause.is_a?(Hash)
        @clause.flatten.find do |e|
          return true unless (/\basc\b|\bdesc\b/).match(e).nil?
        end
Severity: Minor
Found in lib/montage/query/order_parser.rb - About 35 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 parse_part has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_part(part)
      parsed_part = JSON.parse(part) rescue part

      if is_i?(parsed_part)
        parsed_part.to_i
Severity: Minor
Found in lib/montage/query/query_parser.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