Showing 5 of 64 total issues
Class DoseInfo
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class DoseInfo < ApplicationRecord
belongs_to :drug
def info_string
info_strings = [insufflation_dose_string, oral_dose_string, smoked_dose_string,
Class Drug
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Drug < ApplicationRecord
has_one :dose_info
def self.find_with_aliases(name)
name = name&.downcase
Method test_results
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def test_results
test_result_string = ''
test_result_string += "Marquis test: #{marquis_test}. " if marquis_test
test_result_string += "Mandelin test: #{mandelin_test}. " if mandelin_test
test_result_string += "Mecke test: #{mecke_test}. " if mecke_test
- 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 create_substance_from_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_substance_from_info
return false unless info_lookup
@new_substance = Drug.find_by(name: @name)
return 'skipped' unless @force || @new_substance.nil?
@new_substance = Drug.find_or_create_by(name: @name)
- 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 indefinite_article
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def indefinite_article
first_word = to_s.split(/[- ]/).first
if (first_word[AN_REQUIRING_PATTERNS] || first_word[UPCASE_AN_REQUIRING_PATTERNS]) &&
!(first_word[A_REQUIRING_PATTERNS] || first_word[UPCASE_A_REQUIRING_PATTERNS])
'an'
- 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"