Showing 32 of 32 total issues
Method each_change
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def each_change
old_ln = old_ln_cache = 0
new_ln = new_ln_cache = 0
@changes.each_with_index do |line, i|
Method state_reading_file_metadata
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def state_reading_file_metadata(line)
case line
when /^new file mode (.+)/
@file.status = :new
@file.new_chmod = $1
Method inject_default_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def inject_default_params(app)
return if ARGV.include?('--help') || ARGV.include?('-h')
raw_default_params = app.git_config("reviewit.config#{app.action_name}")
return if raw_default_params.empty?
- 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 send_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def send_request(relative_url, params, method = :post)
klass = method == :get ? Net::HTTP::Get : Net::HTTP::Post
uri = URI(url_for(relative_url))
req = klass.new(uri.to_s)
- 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 diff_file_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def diff_file_status(file)
labels = {}
labels[number_to_human_size(file.size)] = 'black' if file.binary? && !file.delta?
if file.new?
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update
params[:project].delete(:jira_password) if (params[:project] || {})[:jira_password].blank?
if project.update_attributes(project_params)
flash[:success] = 'The project was successfully updated.'
- 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 print_colored_diff
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_colored_diff(diff)
line_to_end_intersection = 0
diff.each_line do |line|
if line.start_with? 'd'
color = WHITE
- 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_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_response(response)
upgrade_and_exit! if response.code == '426'
update_configuration_and_exit! if response.code == '460'
raise response.body if response.code =~ /[^2]\d\d/
- 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 install_rme_gem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def install_rme_gem
gem_file = "/tmp/#{File.basename(@gem_url)}"
puts 'Downloading reviewit gem...'
uri = URI(@gem_url)
http = Net::HTTP.new(uri.host, uri.port)
- 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 perform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform(patch_id, push_type)
fail("Wrong push type (#{push_type})") unless PUSH_TYPES.include?(push_type)
patch = Patch.find(patch_id)
repository = patch.project.repository
- 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 base_text
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def base_text(method, options)
html_args = { id: id(method), placeholder: options[:placeholder] }
html_args[:autofocus] = true if options[:autofocus]
html_args[:type] ||= options[:type] if options.key?(:type)
html_args[:name] ||= "#{@object_name}[#{method}]"
- 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 integrate!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def integrate!(reviewer, patch_id = :not_specified)
raise 'You tried to accept an outdated version of this merge request.' if patch.id != patch_id &&
patch_id != :not_specified
raise 'This merge request is already closed.' if closed?
raise 'This merge request is being integrated by another request, please wait' if integrating?
- 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"