Showing 37 of 64 total issues
Method active_if_here
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def active_if_here(matches)
current_controller = controller.controller_name.to_sym
current_action = controller.action_name.to_sym
sections = case matches
- 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
Function onerror
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
window.onerror = function (message, file, line, code, error) {
Function _show
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
_show: function(title, msg, value, type, callback) {
Method pretty_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pretty_hash(hash, nesting = 0)
tab_size = 2
nesting += 1
pretty = "{"
- 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 github
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def github
github_login = env["omniauth.auth"].extra.raw_info.login
github_token = env["omniauth.auth"].credentials.token
github_user = User.where(:github_login => github_login).first
- 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 function. Open
return 'opera9'; // use e.message
Avoid too many return
statements within this function. Open
return 'opera10b'; // use e.stacktrace, format differs from 'opera10a'
Avoid too many return
statements within this function. Open
return 'opera10a'; // use e.stacktrace
Avoid too many return
statements within this function. Open
return 'other';
Avoid too many return
statements within this function. Open
return 'opera11'; // use e.stacktrace, format differs from 'opera10a', 'opera10b'
Avoid too many return
statements within this function. Open
return 'chrome';
Avoid too many return
statements within this function. Open
return 'firefox';
Method default_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def default_values
if self.new_record?
self.server_environment ||= Hash.new
self.request ||= Hash.new
self.notifier ||= Hash.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 plug_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def plug_params app
app.watchers.build if app.watchers.none?
app.issue_tracker = IssueTracker.new unless app.issue_tracker_configured?
app.notification_service = NotificationService.new unless app.notification_service_configured?
app.copy_attributes_from(params[:copy_attributes_from]) if params[:copy_attributes_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
Method copy_attributes_with_mapping
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_attributes_with_mapping(map_hash, copy_from, copy_to)
map_hash.each do |to_key, from_key|
if from_key.respond_to? :call
copy_to.send("#{to_key}=", from_key.call(copy_from))
else
- 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 url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def url
acc_url = account.start_with?('http') ? account : "http://#{account}"
acc_url = acc_url.gsub(/\/$/, '')
URI.parse("#{acc_url}/projects/#{project_id}").to_s
rescue URI::InvalidURIError
- 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 url_to_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def url_to_file(file_path, line_number = nil)
# alt_project_id let's users specify a different project for tickets / app files.
project = self.alt_project_id.present? ? self.alt_project_id : self.project_id
url = "#{self.account.gsub(/\/$/, '')}/projects/#{project}/repository/revisions/#{app.repository_branch}/changes/#{file_path.sub(/\[PROJECT_ROOT\]/, '').sub(/^\//,'')}"
line_number ? url << "#L#{line_number}" : url
- 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"