Method build_version
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_version(name, options)
if !versions.has_key?(name)
uploader = Class.new(self)
const_set("Uploader#{uploader.object_id}".tr('-', '_'), uploader)
uploader.version_names += [name]
Method version_exists?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def version_exists?(name)
name = name.to_sym
return false unless self.class.versions.has_key?(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 source_versions_of
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def source_versions_of(requested_names)
versions.inject([]) do |sources, (name, uploader)|
next sources unless requested_names.include?(name)
next sources unless source_name = uploader.class.version_options[:from_version]
- 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 url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def url(*args)
if (version = args.first) && version.respond_to?(:to_sym)
raise ArgumentError, "Version #{version} doesn't exist!" if versions[version.to_sym].nil?
# recursively proxy to version
versions[version.to_sym].url(*args[1..-1])
- 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"