apprentus/aristotle

View on GitHub

Showing 6 of 6 total issues

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

    def self.is_everything_covered_for?(logic_object)
      logic_class = logic_object[:logic_class]

      if logic_class.nil?
        puts "--> Create file #{logic_object[:relative_class_file]} with the following contents:"
Severity: Minor
Found in lib/aristotle/utility.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 is_everything_covered_for? has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.is_everything_covered_for?(logic_object)
      logic_class = logic_object[:logic_class]

      if logic_class.nil?
        puts "--> Create file #{logic_object[:relative_class_file]} with the following contents:"
Severity: Minor
Found in lib/aristotle/utility.rb - About 1 hr to fix

    Method load_commands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.load_commands
          @commands ||= {}
    
          return if @commands != {}
    
    
    Severity: Minor
    Found in lib/aristotle/logic.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 process has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(logic_method, return_command: false)
          self.class.commands(logic_method).each do |command|
            next unless command.condition_passes_with?(@object)
    
            return_value = command.do_action_with(@object)
    Severity: Minor
    Found in lib/aristotle/logic.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 format_fragment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_fragment(fragment, part, show_code: true)
          return '' if part != :action && part != :condition
    
          text = fragment.send(part).to_s
          text.gsub!(/'([^']+)'/, '<strong>\1</strong>')
    Severity: Minor
    Found in lib/aristotle/presenter.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(line, conditions, actions)
          @action, @condition = line.split(' if ', 2).map(&:strip)
    
          raise 'Badly formatted line' if @action == '' || @condition == ''
    
    
    Severity: Minor
    Found in lib/aristotle/command.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