elcodedocle/gplusraffle

View on GitHub
webapp/webappClientController.js

Summary

Maintainability
D
2 days
Test Coverage

File webappClientController.js has 354 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*jshint bitwise: true */
/*jslint bitwise: true */
/*global $:false, Spinner:false, ActiveXObject:false*/

/**
Severity: Minor
Found in webapp/webappClientController.js - About 4 hrs to fix

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

    function createTableBody(data){
        "use strict";
        var tbody, propertyName, row, index, td;
        tbody = document.createElement('tbody');
        for (index in data.data.rows){
    Severity: Minor
    Found in webapp/webappClientController.js - 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 processOk has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function processOk(request,responseText,subtitle){
        "use strict";
        var data;
        try {
            data=JSON.parse(responseText);
    Severity: Major
    Found in webapp/webappClientController.js - About 2 hrs to fix

      Function processFail has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      function processFail(request,responseText,status,subtitle){
          "use strict";
          var data, response;
          if(
              status === 404 &&
      Severity: Minor
      Found in webapp/webappClientController.js - 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

      Function createTableBody has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function createTableBody(data){
          "use strict";
          var tbody, propertyName, row, index, td;
          tbody = document.createElement('tbody');
          for (index in data.data.rows){
      Severity: Minor
      Found in webapp/webappClientController.js - About 1 hr to fix

        Function processOk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function processOk(request,responseText,subtitle){
            "use strict";
            var data;
            try {
                data=JSON.parse(responseText);
        Severity: Minor
        Found in webapp/webappClientController.js - 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

        Function requestAndProcessPageJSONData has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function requestAndProcessPageJSONData(request){
            "use strict";
            var xmlhttp, //intervalID = window.setInterval(processingDots,1000), 
                spinnerSettings, spinner, params, subtitle;
            if (request.hasOwnProperty('subtitle')){
        Severity: Minor
        Found in webapp/webappClientController.js - About 1 hr to fix

          Function processFail has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function processFail(request,responseText,status,subtitle){
              "use strict";
              var data, response;
              if(
                  status === 404 &&
          Severity: Minor
          Found in webapp/webappClientController.js - About 1 hr to fix

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

            function formatDateTimeString(dateTimeString){
                "use strict";
                var dateParts = dateTimeString.split(' '),
                    timeParts = dateParts[1].split(':'),
                    dateDateParts = dateParts[0].split('-'),
            Severity: Minor
            Found in webapp/webappClientController.js - About 1 hr to fix

              Function requestAndProcessPageJSONData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              function requestAndProcessPageJSONData(request){
                  "use strict";
                  var xmlhttp, //intervalID = window.setInterval(processingDots,1000), 
                      spinnerSettings, spinner, params, subtitle;
                  if (request.hasOwnProperty('subtitle')){
              Severity: Minor
              Found in webapp/webappClientController.js - 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 (typeof data.data.rows[index][propertyName] !== 'undefined') {
                                      //noinspection JSUnfilteredForInLoop
                                      switch (data.data.columns[propertyName]){
                                          case 'raffleid':
                                              //noinspection JSUnfilteredForInLoop
              Severity: Major
              Found in webapp/webappClientController.js - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status