SST-CTF/typing-test

View on GitHub

Showing 10 of 494 total issues

Function stopCP has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

(function stopCP () {
    var onload = window.onload;

    window.onload = function () {
        if (typeof onload == "function") {
Severity: Minor
Found in js/main.js - About 5 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 endTest has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function endTest() {
    //Clear the timer that tracks the progress of the test, since it's complete
    clearTimeout(checkStatusInt);

    //Initialize an object with the current date/time so we can calculate the difference    
Severity: Minor
Found in js/main.js - About 2 hrs to fix

    Function calcStat has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function calcStat() {
        //If something goes wrong, we don't want to cancel the test -- so fallback error proection (in a way, just standard error handling)
        try {
            //Reset the timer to fire the statistical update function again in 250ms
            //We do this here so that if the test has ended (below) we can cancel and stop it
    Severity: Minor
    Found in js/main.js - About 1 hr to fix

      Function stopCP has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      (function stopCP () {
          var onload = window.onload;
      
          window.onload = function () {
              if (typeof onload == "function") {
      Severity: Minor
      Found in js/main.js - About 1 hr to fix

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

            window.onload = function () {
                if (typeof onload == "function") {
                    onload.apply(this, arguments);
                }
        
        
        Severity: Minor
        Found in js/main.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

              if (
                  person.search("ota") === - 1 && 
                  person.search("Ota") === - 1 && 
                  person.search("fruhwirth") === - 1 && 
                  person.search("Fruhwirth") === - 1 && 
          Severity: Critical
          Found in js/main.js - About 1 hr to fix

            Function calcStat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function calcStat() {
                //If something goes wrong, we don't want to cancel the test -- so fallback error proection (in a way, just standard error handling)
                try {
                    //Reset the timer to fire the statistical update function again in 250ms
                    //We do this here so that if the test has ended (below) we can cancel and stop it
            Severity: Minor
            Found in js/main.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 myFunction has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function myFunction() 
            {
                var person = prompt("Please enter your name", "");
                // Profanity Filter (if there is a better way to do this LMK)
                if (
            Severity: Minor
            Found in js/main.js - About 1 hr to fix

              Function endTest has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function endTest() {
                  //Clear the timer that tracks the progress of the test, since it's complete
                  clearTimeout(checkStatusInt);
              
                  //Initialize an object with the current date/time so we can calculate the difference    
              Severity: Minor
              Found in js/main.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 readTextFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function readTextFile(file, arrayData)
              {
                  var rawFile = new XMLHttpRequest();
                  rawFile.open("GET", file, false);
                  rawFile.onreadystatechange = function ()
              Severity: Minor
              Found in js/main.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