pyrmont/taipo

View on GitHub

Showing 26 of 30 total issues

Method constraints= has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def constraints=(csts)
      msg = 'Argument csts was not a Taipo::TypeElement::Constraints.'
      raise ::TypeError, msg unless csts.is_a? Taipo::TypeElement::Constraints

      names = Hash.new
Severity: Minor
Found in lib/taipo/type_element.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 to_s has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def to_s
        inner = self.reduce(nil) do |memo_e,component|
                  el = component.reduce(nil) do |memo_c,c|
                         (memo_c.nil?) ? c.to_s : memo_c + '|' + c.to_s
                       end
Severity: Minor
Found in lib/taipo/type_element/children.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 process_constraints has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.process_constraints(stack, chars:, index:)
      stack.add_constraints

      inside = { ss: false, ds: false, re: false, esc: false }
      content = ''
Severity: Minor
Found in lib/taipo/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_definition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse_definition(str)
      Taipo::Parser::Validater.validate str

      stack = Taipo::Parser::Stack.new
      i = 0
Severity: Minor
Found in lib/taipo/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 throw_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.throw_error(object:, name:, definition:, result: false)
      subject = (result) ? "The return value of #{name}" : "Object '#{name}'"

      if Taipo::Utilities.instance_method? definition
        msg = "#{subject} does not respond to #{definition}."
Severity: Minor
Found in lib/taipo/utilities.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

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

      def set_all(status, except: {})
        @status.transform_values! { |v| v = status unless v == :disabled }
        except[:exceptions].each do |k|
          @status[k] = except[:status] unless @status[k] == :disabled
        end
Severity: Minor
Found in lib/taipo/parser/syntax_state.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