Showing 14 of 14 total issues
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|
- Read upRead up
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 29 (exceeds 5 allowed). Consider refactoring. Open
def to_s
puts "[states]"
@states.each {|state| puts "#{state.is_a?(Array) ? state.map(&:to_s) : state}, " }
puts "[initial_states]"
@initial_states.each {|state| puts "#{state.is_a?(Array) ? state.map(&:to_s) : state}, " }
- Read upRead up
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_nfa
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def generate_nfa nfa, set
if @variables.empty?
if @coefficient == 0
elsif @coefficient < 0
nfa.add_initial [self, @coefficient]
- Read upRead up
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
Method include?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def include? set
# setの変数に0を代入して計算
set_offset = set.calc 0
# その値がselfに含まれているか確認
input_string = set_offset < 0 ? "b" * (- set_offset) : "a" * set_offset
- Read upRead up
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_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
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|
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
- Read upRead up
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_nfa
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_nfa nfa, set
if @variables.empty?
if @coefficient == 0
elsif @coefficient < 0
nfa.add_initial [self, @coefficient]
Method <<
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def << set
expanded = false
@elements.each { |self_set|
next if expanded
expanded_set = self_set.expand(set) || set.expand(self_set)
- Read upRead up
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 expand
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def expand set
return self if self.include? set
return nil unless self.check_lank == 1 && set.check_lank == 0
set_offset = set.calc 0
if self.calc(-1) == set_offset
- Read upRead up
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?
- Read upRead up
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 <<
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def << term
new_elements = []
added_flag = false
@elements.each do |element|
if (element =~ term) && (not added_flag)
- Read upRead up
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_dfa
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def generate_dfa dfa, states, state_setset
return dfa if state_setset.include? states
old_dfa = dfa.dup
@inputs.each do |input|
next_states = states.inject(Set.new) do |result, state|
- Read upRead up
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"