Class ContentBlob
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentBlob < ActiveRecord::Base
include Seek::ContentTypeDetection
include Seek::PdfExtraction
include Seek::MimeTypes
Method dump_tmp_io_object_to_file
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def dump_tmp_io_object_to_file
raise Exception.new("You cannot define both :data content and a :tmp_io_object") unless @data.nil? || @tmp_io_object.nil?
t1 = Time.now
unless @tmp_io_object.nil?
begin
- 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 check_url_content_type
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_url_content_type
unless url.nil?
begin
response = RestClient.head url
type = response.headers[:content_type] || ""
- 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 data_io_object
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def data_io_object
return @tmp_io_object unless @tmp_io_object.nil?
return StringIO.new(@data) unless @data.nil?
return File.open(filepath,"rb") if file_exists?
return StringIO.new(data_old) unless data_old.nil?
- 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
Avoid too many return
statements within this method. Open
return nil