Showing 64 of 86 total issues
Consider simplifying this complex logical expression. Open
if (typeof document !== "undefined" && !("classList" in document.createElement("a"))) {
(function (view) {
"use strict";
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@authenticated = false
@configuration = options
if @configuration[:url]
uri = URI.parse(@configuration[: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"
Further reading
Method read_config_from_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_config_from_file(config_file)
if File.file? config_file
config = ::YAML.load(ERB.new(File.new(config_file).read).result)[app_env]
config = config['mongodb_logger'] if config && config.has_key?('mongodb_logger')
return config unless config.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 enable_mongodb_logger
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def enable_mongodb_logger
return yield unless Rails.logger.respond_to?(:mongoize)
f_session = (request.respond_to?(:session) ? request.session : session)
Rails.logger.mongoize({
method: request.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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options = {})
@configuration = options
if @configuration[:url]
uri = URI.parse(@configuration[:url])
@configuration[:database] = uri.path.gsub(/^\//, '')
- 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 record_serializer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def record_serializer(rec, nice = true)
[:messages, :params].each do |key|
if msgs = rec[key]
msgs.each do |i, j|
msgs[i] = (true == nice ? nice_serialize_object(j) : j.inspect)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(path = nil, level = DEBUG)
set_root_and_env
begin
path ||= File.join(app_root, "log/#{app_env}.log")
@level = level
- 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
else if (y == 0) { return '' }
Avoid too many return
statements within this function. Open
else { return y }
Avoid too many return
statements within this function. Open
else if (y < 1 && y > 0) { return y.toFixed(2) }
Avoid too many return
statements within this function. Open
else if (y >= 1024) { return y / 1024 + "K" }
Avoid too many return
statements within this function. Open
else { return y }
Avoid too many return
statements within this function. Open
else if (y < 1 && y > 0) { return y.toFixed(2) }
Avoid too many return
statements within this function. Open
else if (y == 0) { return '' }
Method rescue_connection_failure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rescue_connection_failure(max_retries = 40)
success = false
retries = 0
while !success
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 set_params_to_methods
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_params_to_methods
@params.each do |k,v|
self.send("#{k}=", v) if self.respond_to?(k) && v && !v.blank?
end unless @params.blank?
end
- 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 configure
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure
@db_configuration = {
host: 'localhost',
port: 27017,
ssl: false,
- 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 render_progress
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_progress(percent)
@progress = percent
print "["
print "*" * [(percent/10).to_i, 10].min
- 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 Legend
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Rickshaw.Graph.Legend = function(args) {
var element = this.element = args.element;
var graph = this.graph = args.graph;
- 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 addItem
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addItem: function(item) {
if (typeof(item.name) === 'undefined') {
throw('addItem() needs a 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"