Showing 64 of 133 total issues
Function parsleyValidator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
parsleyValidator : function(cb) {
var validator = function() {};
_.extend(validator, {
validationMinlength: 1,
validators : {
Function _saveCategory
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_saveCategory : function(cb) {
this._checkFirstCategoryCondition(function(currentDashboardModel) {
this.model = new DashboardModel({
category : true,
dashboardId : this.dashboard.id
Method make_constants_module
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def make_constants_module(*args)
mod_name = args[0]
mod_opts = args[1]
m = Module.new
constant_values = []
- 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 _saveMonitor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_saveMonitor : function(cb) {
this._setMetrics();
this.model.save({
'id' : null,
Function stop
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
stop : function( e, ui ) {
var $el = ui.helper,
offset = ui.offset,
match = [],
thisId = $el.attr('id'),
Function testMetrics
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
testMetrics : function() {
this._setMetrics();
$.post('/monitor.json', this.model.toJSON(), function(result) {
if (result.graph_data) {
Function _toggleFullscreen
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_toggleFullscreen : function(selector, mirrorRef, closeButton, backButton) {
var self = this,
editorEl = $(selector);
if (!editorEl.hasClass('fullscreen')) {
Method boot!
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def boot!
Celluloid.logger = @logger = config.logger if(config.logger.present?)
logger.info "booting..."
logger.info "using configuration: \n#{config.dump}"
if config.verify?
Method metric
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def metric
unless @metric
@metric = if path?
self.elements[0].text
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 alias
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def alias
unless @alias
e = self.expressions.detect {|e| e.identifier.try(:text) == "alias" }
if e && e.args && e.args.elements
alias_val = e.args.elements.last.detect { |e| e.kind_of?(Graphite::TargetGrammer::StringLiteral) }
- 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 calculate_durations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate_durations(errors)
last_with_error = nil # most recently found error
(errors.each do |e|
if e.status == Status::SUCCESS
unless last_with_error.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"
Further reading
Method validate_each
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, value)
passed = true
if value.present?
uri = URI.parse(value) rescue nil
unless uri.present? && uri.scheme.present? && (uri.scheme.downcase=="http" || uri.scheme.downcase=="https")
- 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 color
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def color
unless @color
e = self.expressions.detect {|e| e.identifier.try(:text) == "color" }
if e && e.args && e.args.elements
color_val = e.args.elements.last.detect { |e| e.kind_of?(Graphite::TargetGrammer::StringLiteral) }
- 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 eval
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def eval(data, expr = nil, initial_ns = {}, verbose = false, immediate = false)
logger.debug "#{self} eval"
# prepare variable map for the monitor process
namespace = create_namespace(data, initial_ns)
- 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 run
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def run(metrics,
monitor_expr = nil,
minutes = nil,
namespace = {},
verbose = false,
Avoid deeply nested control flow statements. Open
if (!_.isNull(timeIndex)) {
chart.xAxis[0].addPlotLine({
id : 'plotLine',
value : timeIndex,
color : 'green',
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
@errors = if params[:metrics].empty?
[ "No metrics were provided" ]
else
metrics_validator = Rearview::MetricsValidator.new({attributes: [:metrics]})
- 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 percentage_errors
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def percentage_errors(metric, comparison_metrics, limit_value, limit_type, minutes = @minutes)
Function _compile
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
_compile : function(content, el, append, data, cb) {
Method eval
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def eval(data, expr = nil, initial_ns = {}, verbose = false, immediate = false)