ktonon/code_node

View on GitHub

Showing 4 of 4 total issues

Method add_node has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def add_node(s)
      node = @graph.node_for(s[0], s[1]) do |node|
        if find_relations? && s[0] == :class && !s[2].nil?
          super_node = @graph.node_for :class, s[2], :not_sure_if_nested => true
          node.inherits_from super_node unless super_node.nil?
Severity: Minor
Found in lib/code_node/sexp_walker.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 node_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def node_for(node_type, s, opt={}, &block)
          name = determine_name s
          return if name.nil?
    
          node = if opt[:not_sure_if_nested]
Severity: Minor
Found in lib/code_node/ir/graph/builder_methods.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 style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def style(name=nil, style={}, &block)
        style, name = name, nil if name.is_a?(Hash)
        if (name.nil? && block.nil?) || (name && block)
          raise ArgumentError.new('Provide either a name or a block') 
        end
Severity: Minor
Found in lib/code_node/dsl/graph_definer.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 determine_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def determine_name(s)
          name = if s.is_a? Symbol
            s
          elsif s[0] == :const
            s[1]
Severity: Minor
Found in lib/code_node/ir/graph/builder_methods.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