Showing 2 of 2 total issues
Method load_available_adapters
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.load_available_adapters adapters_short_names
available_adapters = adapters_short_names.collect do |short_name|
next if short_name == 'rails' && (ActiveSupport.respond_to?(:version) && ActiveSupport.version >= Gem::Version.new('4.1.0'))
next if short_name == 'rails_api' && (ActiveSupport.respond_to?(:version) && ActiveSupport.version >= Gem::Version.new('5.0.0'))
adapter_name = "simple_token_authentication/adapters/#{short_name}_adapter"
- 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 parse_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_options(options)
unless options[:fallback].presence
if options[:fallback_to_devise]
options[:fallback] = :devise
elsif options[:fallback_to_devise] == false
- 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"