Showing 133 of 133 total issues
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');
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( $metricsEditor.data('beforeFullscreen') ) {
$metricsEditor.height($metricsEditor.data('beforeFullscreen').height);
$metricsEditor.width($metricsEditor.data('beforeFullscreen').width);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( $expressionsEditor.data('beforeFullscreen') ) {
$expressionsEditor.height($expressionsEditor.data('beforeFullscreen').height);
$expressionsEditor.width($expressionsEditor.data('beforeFullscreen').width);
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 61.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.$el.find('#namePagerForm .pager-duty .help.label').tooltip({
trigger : 'click',
html : true,
placement : 'left',
delay : { show : 100, hide : 200 },
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
this.$el.find('#cronScheduleForm .set-schedule .help.label').tooltip({
trigger : 'click',
html : true,
placement : 'left',
delay : { show : 100, hide : 200 },
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
Similar blocks of code found in 3 locations. Consider refactoring. Open
self.$el.find('#viewSchedule .help.label').tooltip({
trigger : 'click',
html : true,
placement : 'left',
delay : { show : 100, hide : 200 },
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
self.$el.find('.help:nth-child(2)').tooltip({
trigger : 'click',
html : true,
placement : 'right',
delay : { show : 100, hide : 200 },
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
self.$el.find('#viewSettings .monitor-meta .pager-duty .help.label').tooltip({
trigger : 'click',
html : true,
placement : 'left',
delay : { show : 100, hide : 200 },
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 60.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 _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();
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 setNameScheduleHelp
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
setNameScheduleHelp : function() {
$cronHelpContent = '';
$alertHelpContent = '';
$.ajax({
url : rearview.path + '/help/cron.html',
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];
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)
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()