Showing 11 of 11 total issues
Class Model
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Model
attr_reader :parsed_uri, :parsed_domain
def initialize(uri, domain = nil)
Class URI
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class URI
extend Forwardable
LOCALHOST_REGEXP = /(\A|\.)localhost\z/
Method parse
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def parse
return uri if uri.is_a?(Addressable::URI)
Addressable::URI.parse(base_uri).tap do |parsed_uri|
parsed_uri.join!(uri) if @base_uri
- 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 block_builder
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def block_builder
proc do |uri|
if cleaned?
uri.clean!
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
Class Parser
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Parser
class << self
def call(uri, options = {}, &blk)
Method directory
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def directory
unless path.nil? || path.empty?
parts = path.split('/')
if parts.empty?
'/'
- 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
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse
return uri if uri.is_a?(Addressable::URI)
Addressable::URI.parse(base_uri).tap do |parsed_uri|
parsed_uri.join!(uri) if @base_uri
Method call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(uri, options = {}, &blk)
return nil unless uri
parser = new(uri, options).tap do |uri|
if block_given?
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(uri, domain = nil)
unless uri.is_a?(Addressable::URI)
raise RequiresAddressableURI,
"#{uri} must be an Addressable::URI"
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 normalize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalize
parse.tap do |uri|
uri.path = uri.path.squeeze('/')
uri.path = uri.path.chomp('/') if uri.path.size != 1
uri.query = nil if uri.query && uri.query.empty?
- 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 suffix
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def suffix
if path
ext = File.extname(path)
ext[0] = '' if ext[0] == '.'
ext.empty? ? nil : ext
- 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"