dgarlitt/karma-nyan-reporter

View on GitHub

Showing 6 of 10 total issues

Function DrawUtil has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function DrawUtil(numOfLines) {
  var width = shell.getWidth() * 0.75 | 0;
  var maxHeight = shell.getHeight() - 1;

  this.numberOfLines = Math.max(4, Math.min(numOfLines, maxHeight));
Severity: Minor
Found in lib/util/draw.js - About 3 hrs 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 DrawUtil has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function DrawUtil(numOfLines) {
  var width = shell.getWidth() * 0.75 | 0;
  var maxHeight = shell.getHeight() - 1;

  this.numberOfLines = Math.max(4, Math.min(numOfLines, maxHeight));
Severity: Major
Found in lib/util/draw.js - About 3 hrs to fix

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

    var ShellUtility = function() {
      var self = this;
      var winSize = useStdout ? stdout.getWindowSize(1) : [75, 4];
    
      this.getWidth = function() {
    Severity: Minor
    Found in lib/util/shell.js - About 1 hr to fix

      Function onSpecComplete has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      NyanCat.prototype.onSpecComplete = function(browser, result) {
        // don't pollute original object
        this.stats = Object.create(browser.lastResult);
      
        // sum up tests stats
      Severity: Minor
      Found in lib/nyanCat.js - About 1 hr to fix

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

          function printBrowserErrors(rainbowify, browserErrors) {
            if (rainbowify && browserErrors)  {
              var hashes = '##########'.split('');
              var rainbowifyEach = function(val) {
                write(rainbowify(val));
        Severity: Minor
        Found in lib/util/printers.js - About 1 hr to fix

          Function printBrowserErrors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            function printBrowserErrors(rainbowify, browserErrors) {
              if (rainbowify && browserErrors)  {
                var hashes = '##########'.split('');
                var rainbowifyEach = function(val) {
                  write(rainbowify(val));
          Severity: Minor
          Found in lib/util/printers.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