KarrLab/nose2unitth

View on GitHub

Showing 10 of 23 total issues

Function TableSort has a Cognitive Complexity of 182 (exceeds 5 allowed). Consider refactoring.
Open

function TableSort() {
    
    var table = new Object; // The table to be sorted
    var columnNames = new Array;
    var tableRows = new Array;
Severity: Minor
Found in examples/html/js/tablesort.js - About 3 days 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 TableSort has 184 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function TableSort() {
    
    var table = new Object; // The table to be sorted
    var columnNames = new Array;
    var tableRows = new Array;
Severity: Major
Found in examples/html/js/tablesort.js - About 7 hrs to fix

    Function isort has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function isort(desc, start, step) {
            
            for(var j=start+step; j<N; j+=step) { 
                
                if (desc==true) {
    Severity: Major
    Found in examples/html/js/tablesort.js - About 3 hrs to fix

      Function read_nose has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_nose(in_file):
              """ Parse nose-style test reports into a `dict`
      
              Args:
                  in_file (:obj:`str`): path to nose-style test report
      Severity: Minor
      Found in nose2unitth/core.py - About 2 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 sortOnColumn has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function sortOnColumn(column) {
              
              columnIdx = column.cellIndex;
              columnTypeAbbr = column.abbr; // In case there is some special comparison needed.
              
      Severity: Minor
      Found in examples/html/js/tablesort.js - About 1 hr to fix

        Function write_unitth has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def write_unitth(suites, out_dir):
                """ Write UnitTH-style test reports 
        
                Args:
                    suites (:obj:`dict`): dictionary of test suites
        Severity: Minor
        Found in nose2unitth/core.py - About 1 hr 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

        Avoid deeply nested control flow statements.
        Open

                                if (sIdx1<0) {
                                    sStripped = second;
                                } else {
                                    var sIdx2 = second.lastIndexOf('<');
                                    sStripped = second.substring((sIdx1+1),(sIdx2-1));
        Severity: Major
        Found in examples/html/js/tablesort.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (fStripped>sStripped) {
                                      exchange(i, (i-step));
                                  }
          Severity: Major
          Found in examples/html/js/tablesort.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                } else if ('number'==columnTypeAbbr) {
                                    var fa = parseFloat(first);
                                    var sa = parseFloat(second);
                                    if (isNaN(fa) ) {
                                        fa = 0;
            Severity: Major
            Found in examples/html/js/tablesort.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (fIdx1<0) {
                                          fStripped = first;
                                      } else {
                                          var fIdx2 = first.lastIndexOf('<');
                                          fStripped = first.substring((fIdx1+1),(fIdx2-1));
              Severity: Major
              Found in examples/html/js/tablesort.js - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language