Showing 57 of 57 total issues
Method modify_mp3splt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify_mp3splt(source, source_info, target, start_offset, end_offset)
Method from_executables
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.from_executables(audio_master, im_convert_exe, im_identify_exe, spectrogram_defaults, temp_dir)
Method modify_command
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def modify_command(source, source_info, target, start_offset = nil, end_offset = nil)
Method check_integrity_item
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_integrity_item(hash)
return nil if hash.blank?
return nil if hash[:id].starts_with?('graph')
return nil if hash[:id].starts_with?('audio format')
- 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 arg_offsets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def arg_offsets(start_offset, end_offset)
cmd_arg = ''
# start offset
# -ss Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.
- 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 arg_offsets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def arg_offsets(start_offset, end_offset)
# Cuts portions out of the audio. Any number of positions may be given; audio is not sent
# to the output until the first position is reached. The effect then alternates between
# copying and discarding audio at each position.
- 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 arg_offsets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def arg_offsets(start_offset, end_offset)
cmd_arg = ''
unless start_offset.blank?
start_offset_formatted = Time.at(start_offset.to_f).utc.strftime('%H:%M:%S.%2N')
- 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 info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def info(source)
fail ArgumentError, "Source is not a wac file: #{source}" unless source.match(/\.wac$/)
fail Exceptions::AudioFileNotFoundError, "Could not find #{source}." unless File.exist?(source)
# WAac header format:
- 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 if hash[:description].starts_with?('max_analyze_duration')
Avoid too many return
statements within this method. Open
return nil if hash[:description].starts_with?('parser not found for')
Avoid too many return
statements within this method. Open
return nil if hash[:description].starts_with?('Application provided invalid, non monotonically increasing dts to muxer in stream')
Method modify_command
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def modify_command(source, target)
fail ArgumentError, "Source is not a png file: #{source}" unless source.match(/\.png/)
fail ArgumentError, "Target is not a png file: : #{target}" unless target.match(/\.png/)
fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
# target will probably already exist, coz we're overwriting the image
- 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 arg_colour
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def arg_colour(colour)
cmd_arg = ''
colours_available = AudioSox.colour_options.map { |k, v| "#{k} (#{v})" }.join(', ')
colour_param = ''
- 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 info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def info(source)
fail Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exists? source
fail Exceptions::FileEmptyError, "Source exists, but has no content: #{source}" if File.size(source) < 1
if File.extname(source) == '.wac'
- 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_ffprobe_output
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_ffprobe_output(source, execute_msg)
# ffprobe std err contains info (separate on first equals(=))
result = {}
ffprobe_current_block_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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if line.include?(':')
colon_index = line.index(':')
new_value = line[colon_index+1, line.length].strip
new_key = line[0, colon_index].strip
result[new_key] = new_value
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 28.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if line.include?(':')
colon_index = line.index(':')
new_value = line[colon_index+1, line.length].strip
new_key = line[0, colon_index].strip
result[new_key] = new_value
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 28.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76