Showing 10 of 71 total issues
Method valid?
has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring. Open
def valid?
return @errors.blank? if @validated
files.each_with_index do |file, index|
prefix = "files/#{index}/"
- 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 valid?
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def valid?
return @errors.blank? if @validated
files.each_with_index do |file, index|
prefix = "files/#{index}/"
Method get
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get(scope)
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
# Instead of
# implements Types::LocIdBaseType, inherit: true
Method normalize_params
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def normalize_params
files.map! do |file|
case file[:action].to_sym
when :create
{path: file[:path],
Method instrument
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def instrument(_type, field)
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
old_resolve = field.resolve_proc
field.redefine do
Method instrument
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def instrument(_type, field)
# rubocop:enable Metrics/MethodLength
# rubocop:enable Metrics/AbcSize
old_resolve = field.resolve_proc
field.redefine do
- 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 popen
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.popen(cmd, path = nil, vars = {})
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength
unless cmd.is_a?(Array)
raise 'System commands must be given as an array of strings'
- 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 write?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write?
# rubocop:enable Metrics/MethodLength, Metrics/AbcSize
return false if resource.nil?
owner = resource.owner
return false if resource.remote_type == 'mirror'
- 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 save
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save
normalize_params
raise ValidationFailed, errors: @errors unless valid?
self.commit_sha =
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 process
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process
return if Document.where(file_version_id: file_version.id).empty?
previous_revision = find_previous_revision
return if previous_revision.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"