Showing 8 of 8 total issues
Method fulltext_dependent_models
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def fulltext_dependent_models(columns=nil)
columns ||= fulltext_columns
if columns.is_a? Hash
columns = Array.wrap(columns)
end
- 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 collect_fulltext_keywords
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def collect_fulltext_keywords(target, columns)
result = []
return result unless target
if columns.is_a? Hash
columns = Array.wrap(columns)
- 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 match
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def match(phrase, options={})
options = options.symbolize_keys
phrase = phrase.split(/[\s ]/) if phrase.is_a? String
phrase.map!{|word| word.gsub(BOOLEAN_META_CHARACTER_REGEXP, '')}
phrase.reject!(&:blank?)
- 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 match
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def match(phrase, options={})
options = options.symbolize_keys
phrase = phrase.split(/[\s ]/) if phrase.is_a? String
phrase.map!{|word| word.gsub(BOOLEAN_META_CHARACTER_REGEXP, '')}
phrase.reject!(&:blank?)
Method fulltext_dependent_models
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fulltext_dependent_models(columns=nil)
columns ||= fulltext_columns
if columns.is_a? Hash
columns = Array.wrap(columns)
end
Method collect_fulltext_keywords
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collect_fulltext_keywords(target, columns)
result = []
return result unless target
if columns.is_a? Hash
columns = Array.wrap(columns)
Method save_fulltext_index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_fulltext_index
if self.fulltext_index
if !fulltext_index.text.empty? && (!defined?(@fulltext_change) || @fulltext_change)
FulltextIndex.update(self)
else
- 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 rebuild_all
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rebuild_all
if connection.tables.include?(FulltextSearchable::TABLE_NAME)
connection.drop_table FulltextSearchable::TABLE_NAME
end
connection.create_fulltext_index_table
- 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"