yuutetu/abst_int

View on GitHub
lib/abst_int/calculus_model/dfa.rb

Summary

Maintainability
C
1 day
Test Coverage

Method self_remain_state_for_ofset_dfa! has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def self_remain_state_for_ofset_dfa! state, current_dfa
      new_dfa = AbstInt::CalculusModel::Dfa.new
      in_states, out_states = Set.new, Set.new
      current_dfa.transition.each do |state1, value|
        value.each do |input, state2|
Severity: Minor
Found in lib/abst_int/calculus_model/dfa.rb - About 4 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

Class Dfa has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Dfa
    def initialize
      @states = Set.new
      @initial_state = nil
      @final_states = Set.new
Severity: Minor
Found in lib/abst_int/calculus_model/dfa.rb - About 2 hrs to fix

    Method generate_orset has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def generate_orset
    
          # アルファベットを数字に変更
          current_dfa = AbstInt::CalculusModel::Dfa.new
          current_dfa.set_initial @initial_state
    Severity: Minor
    Found in lib/abst_int/calculus_model/dfa.rb - About 1 hr to fix

      Method self_remain_state_for_ofset_dfa! has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self_remain_state_for_ofset_dfa! state, current_dfa
            new_dfa = AbstInt::CalculusModel::Dfa.new
            in_states, out_states = Set.new, Set.new
            current_dfa.transition.each do |state1, value|
              value.each do |input, state2|
      Severity: Minor
      Found in lib/abst_int/calculus_model/dfa.rb - About 1 hr to fix

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

            def generate_orset
        
              # アルファベットを数字に変更
              current_dfa = AbstInt::CalculusModel::Dfa.new
              current_dfa.set_initial @initial_state
        Severity: Minor
        Found in lib/abst_int/calculus_model/dfa.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 generate_inter_dfa has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def generate_inter_dfa another_dfa, dfa, state, state_set
              return dfa if state_set.include? state
              @inputs.each do |input|
                return dfa if self.transition.try(:[], state[0]).try(:[], input).nil?
                return dfa if another_dfa.transition.try(:[], state[1]).try(:[], input).nil?
        Severity: Minor
        Found in lib/abst_int/calculus_model/dfa.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

        There are no issues that match your filters.

        Category
        Status