Showing 31 of 71 total issues
Method registered
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.registered(app)
app.get '/metrics' do
@metrics = list_metrics
@title = 'Metrics API'
Function buildTable
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
function buildTable(row_num, col_num) {
table = $('#dashboard');
form = $('#metric-template').clone();
form.removeClass('hidden')
- 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
File dashboard.js
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
function growRow(td, span, cell_content) {
var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
var row = td.closest("tr")
var index = td.index()
var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
Method registered
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.registered(app)
app.get '/metrics' do
@metrics = list_metrics
@title = 'Metrics API'
- 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 registered
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.registered(app)
app.get '/dashboards' do
@dashboards = Dashboard.all
@title = "Dashboards"
File metrics_helpers.rb
has 253 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Bothan
module Helpers
module Metrics
# pseudo controller functions, ones returning objects, ergo ones grape-entity concerns itself with
Function drawTarget
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function drawTarget(value, barcolour, container, datatype) {
var metrics = {
actual: {
data: (value['actual'] / value['annual_target']) * 100,
name: 'Actual progress'
Function validation
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.validation = function(options) {
var // extend params with defaults
settings = $.extend({
submit : false,
Function buildTable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildTable(row_num, col_num) {
table = $('#dashboard');
form = $('#metric-template').clone();
form.removeClass('hidden')
Function populateTable
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function populateTable(metrics) {
$.each(metrics, function(i, metric) {
var table = $('#dashboard');
var panel = $(table.find('td')[i])
Function Gumby
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Gumby() {
this.$dom = $(document);
this.$html = this.$dom.find('html');
this.isOldie = !!this.$html.hasClass('oldie');
this.click = 'click';
Function growCol
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function growCol(td, span, cell_content) {
var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
var table = td.parents('table')
var row = td.closest("tr")
var index = td.index()
- 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 updateSelects
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateSelects(table, row_num, col_num) {
this.row_num = row_num
this.col_num = col_num
var self = this
Function growRow
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function growRow(td, span, cell_content) {
var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
var row = td.closest("tr")
var index = td.index()
var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
Function growCol
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function growCol(td, span, cell_content) {
var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
var table = td.parents('table')
var row = td.closest("tr")
var index = td.index()
Function growRow
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function growRow(td, span, cell_content) {
var cell_content = (typeof cell_content === 'undefined') ? '<td></td>' : cell_content
var row = td.closest("tr")
var index = td.index()
var old_span = (typeof td.attr('rowspan') === 'undefined') ? 1 : Number(td.attr('rowspan'))
- 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 guess_type
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def guess_type(data)
if data.nil?
'chart'
elsif data[:value].class == String
'chart'
- 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 Validation
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Validation($this, req) {
if(Gumby) {
Gumby.debug('Initializing Validation', $this);
}
Function ScrollAnimations
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ScrollAnimations = (function () {
//dont do anything if touch is supported (as scroll event wont fire properly)
if( Modernizr.touch ) return;
Function buildMapTiles
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function buildMapTiles() {
var excludes = ['HERE', 'MapBox', 'Thunderforest']
for (var provider in L.TileLayer.Provider.providers) {
if (excludes.includes(provider)) continue
if (L.TileLayer.Provider.providers[provider].variants) {
- 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"