Showing 50 of 52 total issues
Method parse_stack_trace_line
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_stack_trace_line(line_string)
line = {}
if line_string.match(/in `((.)+)'/)
if line_string.match(/^from .+$/)
Method hash_tree
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def hash_tree(hash = nil, options = { parent: '' })
options.assert_valid_keys(:parent)
hash ||= @list
parent = options[parent].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 add_commit_to_file
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_commit_to_file(file_path, commit)
category = :misc
if file_path.match(/\//)
@files_by_category.each do |current_category, setting|
- 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 accordion
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def accordion
routes = request.env['action_dispatch.routes'].routes.map do |route|
{
source: (route.verb.respond_to?(:source) ? route.verb.source : route.verb).gsub(/[$^]/, ''),
spec: route.path.respond_to?(:spec) ? route.path.spec.to_s : route.path,
- 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 grouped_collection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def grouped_collection(title, collection, group_by)
@grouped_collections ||= {}
collection_key = "#{title}-{group_by}-#{collection.length}"
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(stack_trace, options = {})
@request = options[:request]
@exception = options[:exception]
@rails_root = options[:rails_root] || Rails.root.to_s
@lines_of_code_around = options[:lines_of_code_around] || 5
- 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 associations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def associations(key_constant, options = { parent: ''})
options.assert_valid_keys(:parent)
key_constant = key_constant(key_constant, options[:parent]) if key_constant.is_a?(String)
Method active_record_ancestors
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def active_record_ancestors(klass)
ar_ancestors = []
klass.ancestors.map(&:to_s).uniq.each do |ancestor|
next if (ancestor == klass.to_s || ancestor == 'ActiveRecord::Base')
- 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 commit_attributes_match_criteria?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def commit_attributes_match_criteria?(commit)
if filter_merges && commit.message.match(/^Merge branch /)
return false
elsif commit.message.match(message) && (author.blank? || commit.author.name == author) && between_timespan?(commit.committed_date)
return true
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {log: {}, debug: false})
options ||= {log: {}, debug: false}
options[:log] ||= {}
@debug = options[:debug]
- 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 between_timespan?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def between_timespan?(timestamp)
return true if from.blank? && to.blank?
from_valid = from.present? && Time.parse(from) <= timestamp
to_valid = to.present? && Time.parse(to) >= timestamp
- 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 users
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def users
return @users if @users
@users = []
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _valid?
@errors ||= {}
['workspace', 'repository', 'project_slug', 'branch'].each do |field|
@errors[field] = "can't be blank." if self.send(field).blank?
- 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_write
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_write(line)
begin_reg_exp = "\\[[0-9]+m *"
reg_exp = "#{begin_reg_exp}((INSERT INTO|UPDATE|DELETE FROM)(.)+)$"
return false unless line.match(reg_exp)
- 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_stack_trace_line
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def parse_stack_trace_line(line_string)
line = {}
if line_string.match(/in `((.)+)'/)
if line_string.match(/^from .+$/)
- 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
Consider simplifying this complex logical expression. Open
elsif (from.blank? || to.blank?) && ((from.present? && from_valid) || (to.present? && to_valid))
true
else
false
Method resource_tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resource_tree(presenter, parent_id = '')
content = ""
presenter.each do |title, resource_presenter|
id = parent_id.blank? ? title.parameterize : "#{parent_id}-#{title.parameterize}"
- 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 head
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def head
title, group_by = nil, ''
content = content_tag :th, '', class: 'first'
column_index = 0
- 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 new
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new
repository = Grit::Repo.new(params[:repository_path])
diff = repository.diff(
repository.commit(params[:rev_to]), repository.commit(params[:rev]), params[:path]
- 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 tab
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tab(tab_key)
@content = @tabs_data[tab_key]
content_tag :div, id: "tabs-#{@index}-#{@tab_index}" do
html = if tab_key == 'Request'
- 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"