Method transcode_movie
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def transcode_movie
FFMPEG.logger.info("Running transcoding...\n#{command}\n")
@output = ""
Open3.popen3(*command) do |_stdin, _stdout, stderr, wait_thr|
- 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 apply_transcoder_options
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def apply_transcoder_options
# if true runs #validate_output_file
@transcoder_options[:validate] = @transcoder_options.fetch(:validate) { true }
return if @movie.nil? || @movie.calculated_aspect_ratio.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
Method screenshot_seek_time
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def screenshot_seek_time(options)
# Returns any seek_time for the screenshot and removes it from the options
# such that the seek time can be moved to an input option for improved FFMPEG performance
if options.is_a?(Array)
seek_time_idx = options.find_index('-seek_time') unless options.find_index('-screenshot').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
Method transcode_movie
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transcode_movie
FFMPEG.logger.info("Running transcoding...\n#{command}\n")
@output = ""
Open3.popen3(*command) do |_stdin, _stdout, stderr, wait_thr|
Method validate_output_file
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_output_file(&block)
@errors << "no output file created" unless File.exist?(@output_file)
@errors << "encoded file is invalid" if encoded.nil? || !encoded.valid?
if encoding_succeeded?
- 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 screenshot_to_transcoder_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def screenshot_to_transcoder_options(seek_time, transcoder_options)
return if seek_time.to_s == ''
input_options = transcoder_options[:input_options] || []
# remove ss from input options because we're overriding from seek_time
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(input, output_file, options = EncodingOptions.new, transcoder_options = {})
if input.is_a?(FFMPEG::Movie)
@movie = input
@input = input.path
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"