HansHammel/watchmen

View on GitHub

Showing 25 of 1,086 total issues

Function getRoutes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports = module.exports.getRoutes = function (){

  var PREFIX_PING_PLUGIN = 'watchmen-ping-';

  var router = express.Router();
Severity: Minor
Found in webserver/routes/api-ping-plugins-route.js - About 1 hr to fix

    Function enableUI has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function enableUI() {
            var i,
                el,
                ithSorter = function ithSorter(i) {
                    var col = cols[i];
    Severity: Minor
    Found in coverage/lcov-report/sorter.js - About 1 hr to fix

      Function exports has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      exports = module.exports = (function(){
      
        var DEFAULT_TARGET_UPTIME = 0.99;
        var DEFAULT_TARGET_WARNING_PERCENTAGE = 0.02;
      
      
      Severity: Minor
      Found in scripts/data-load/lib/response-randomizer.js - About 55 mins to fix

      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 getUptime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function getUptime (service, outages, currentOutage, since) {
      
        var totalDownTime = 0;
        var now = +new Date();
        
      Severity: Minor
      Found in lib/reporter.js - About 45 mins to fix

      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 getRoutes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports.getRoutes = function (storage) {
      
        if (!storage) {
          throw new Error('storage needed');
        }
      Severity: Minor
      Found in webserver/routes/api-service-route.js - About 25 mins to fix

      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

      Severity
      Category
      Status
      Source
      Language