Showing 25 of 1,086 total issues
Function addSorting
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
- 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 addSorting
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
var addSorting = (function () {
"use strict";
var cols,
currentSort = {
index: 0,
Function getRoutes
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getRoutes = function (storage) {
if (!storage) {
throw new Error('storage needed');
}
Function ping
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
WatchMen.prototype.ping = function (params, callback) {
var self = this;
var storage = self.storage;
var service = params.service;
Function run
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(programOptions, callback) {
var pingInterval = programOptions.pingInterval || DEFAULT_PING_INTERVAL;
var numberDaysBack = programOptions.numberDaysBack || DEFAULT_NUMBER_DAYS_BACK;
var numberPingsBack = numberDaysBack * 1000 * 60 * 60 * 24 / pingInterval;
Function exports
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = (function () {
function isServiceRestrictedToEmail(service, email) {
if (!service) {
return 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
Function getService
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Reporter.prototype.getService = function(serviceId, callback){
var storage = this.storage;
debug('loading service');
Function exports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (function (){
function md5(str) {
var hash = crypto.createHash('md5');
hash.update(str.toLowerCase().trim());
Function generateLatencyChart
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function generateLatencyChart (options) {
return c3.generate({
size: options.size,
bindto: options.id,
Function exports
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = (function(){
function validateOptionalInt(service, errors, field, options) {
if (service[field]){
validateInt(service, errors, field, options);
Function getRoutes
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getRoutes = function (storage){
if (!storage) {
throw new Error('storage needed');
}
Function exports
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = (function () {
function isServiceRestrictedToEmail(service, email) {
if (!service) {
return false;
Function render
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Charting.render = function (options) {
var latencyData = parseArrayObjectsForCharting(options.latency, 't', 'l');
var latencySerie = latencyData.data;
Function getLatencySince
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
StorageRedis.prototype.getLatencySince = function (service, timestamp, aggregatedBy, callback) {
this.redis.zrevrangebyscore(service.id + ':' + LATENCY_KEY_SUFIX, '+inf', timestamp || '-inf', 'withscores', function (err, data) {
if (err) {
return callback(err);
}
- 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 exports
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports = module.exports = (function(){
function validateOptionalInt(service, errors, field, options) {
if (service[field]){
validateInt(service, errors, field, options);
- 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 getGeneralServiceInfo
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getGeneralServiceInfo(service, storage, callback) {
storage.getCurrentOutage(service, function(err, currentOutage){
if (err) {
return callback(err);
Function configureApp
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
configureApp : function (app){
passport.use(new GoogleStrategy({
clientID: config.auth.GOOGLE_CLIENT_ID,
clientSecret: config.auth.GOOGLE_CLIENT_SECRET,
Function getUptime
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getUptime (service, outages, currentOutage, since) {
var totalDownTime = 0;
var now = +new Date();
Function exports
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports = module.exports = function(storage){
if (!storage) {
throw new Error('storage is required');
}
Function parseLatencyDataFromZset
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function parseLatencyDataFromZset(zset) {
var list = [];
var currentObj;
var accLatency = 0;
for (var i = 0; i < zset.length; i++) {
- 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"