Showing 64 of 133 total issues
Function resizeModal
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
resizeModal : function($modal, size, ignoreHeight) {
var width = $(window).width(),
height = $(window).height(),
widthMultiplier = 0.6,
heightMultiplier = 0.8;
Function success
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
success : function(result) {
// format data for timeline.js
_.each(result, function(alert) {
var startDate = null;
Method exec_process
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_process(expr = "", namespace = {}.to_json, immediate=false)
logger.debug "#{self} exec_process"
# create script template
script_text = self.monitor_script % {utilities: self.utilities_script, expression: expr, timeout: Rearview.config.sandbox_timeout, namespace: namespace}
Method deploy_check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def deploy_check(num_points, deploy, metric)
if metric == deploy
raise "Error: You've passed the deploy metric to be analyzed against itself, which is not a valid analysis."
elsif metric.values.size < (num_points * 2) + 1
raise "Error: Not enough data to evaluate. There must be #{num_points} data points before and after a deploy."
- 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 normalize_results
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def normalize_results(results)
normalized = { status: "error", output: nil, graph_data: nil }
unless results.nil?
if results[:monitor_output]
normalized[:status] = results[:monitor_output][:status]
- 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 initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize : function(options) {
_.bindAll(this);
this.templar = options.templar;
this.dashboardId = ( options.dashboardId ) ? options.dashboardId : null;
Function loadAlertIncidentData
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadAlertIncidentData : function(jobId, $alertEvent, $content, cb) {
var self = this;
// load graph data for popover
var job = self.collection.get(jobId),
Method validate_graphite_connection
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_graphite_connection
if graphite_connection.present?
if !graphite_connection[:url].present?
self.errors.add(:graphite_connection, "graphite URL can't be blank")
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
Function _initCodeMirror
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initCodeMirror : function() {
var $expressions = this.$el.find('#inputExpressions')[0],
expressionsCodeSelector = '.add-monitor .expressions .CodeMirror',
$metrics = this.$el.find('#inputMetrics')[0],
metricsCodeSelector = '.add-monitor .metrics .CodeMirror',
Function updateGraph
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateGraph : function(model, cb, graphData) {
var self = this;
if(graphData) {
self.renderGraphData(self.chart, graphData);
Function auth
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
auth : function() {
// set reference to router in our dashboard
this.indexRouter = ( !this.indexRouter )
? new IndexRouter({
'app' : this
Function success
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
success : function(result) {
if (result.status === 'error') {
this.hideOverlay();
if(_.isEmpty(result.graph_data)) {
this.showOverlay(this.$graph, 'Monitor Error - No Data', 'small-monitor-error-overlay');
Method boot!
has a Cognitive Complexity of 11 (exceeds 5 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?
- 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 _setupMetricsView
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupMetricsView : function() {
var modalContainerEl = $('.add-monitor');
if ( !this.metricsViewInitialized ) {
this.scheduleMonitorBody = $('.add-monitor .modal-body').detach();
Function updateMonitor
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateMonitor : function(e) {
var self = this,
monitor = e.data.model,
test = e.data.test,
toDate = e.data.toDate,
Function _initializeCodeMirror
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initializeCodeMirror : function() {
var self = this,
$expressions = self.$el.find('#inputExpressions')[0],
$metrics = self.$el.find('#inputMetrics')[0];
Function setNameScheduleHelp
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
setNameScheduleHelp : function() {
$cronHelpContent = '';
$alertHelpContent = '';
$.ajax({
url : rearview.path + '/help/cron.html',
Method scoped_eval
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scoped_eval(namespace)
# Copy instance variables from top-level class into current scope
namespace.keys.each do |v|
instance_variable_set "#{v}".to_sym, namespace[v]
end
Function _moveAllCurrentMonitorsToCategory
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
_moveAllCurrentMonitorsToCategory : function() {
this.model.save({
userId : this.user.get('id'),
name : this.$el.find('#categoryName').val(),
description : this.$el.find('#categoryDescription').val()
Method eval
has 29 lines of code (exceeds 25 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)