expertiza/expertiza

View on GitHub
app/assets/javascripts/grading.js

Summary

Maintainability
C
1 day
Test Coverage

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

  function toggleTeams(numteams, visible) {
      for (var i = 0; i < numteams; i++) {
          var sublistsize = 1;
          var elementId = 'team' + i;
          var obj = document.getElementById(elementId + '_' + sublistsize);
Severity: Minor
Found in app/assets/javascripts/grading.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 collapseObj has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function collapseObj(obj, atag, header) {
      obj.style.display = 'none';
      atag.innerHTML = '<img src="/assets/expand.png">';
      header.style.backgroundColor = 'white';
      header.style.color = "#000000";
Severity: Minor
Found in app/assets/javascripts/grading.js - About 1 hr to fix

    Function collapseObj has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      function collapseObj(obj, atag, header) {
          obj.style.display = 'none';
          atag.innerHTML = '<img src="/assets/expand.png">';
          header.style.backgroundColor = 'white';
          header.style.color = "#000000";
    Severity: Minor
    Found in app/assets/javascripts/grading.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 toggleTeams has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function toggleTeams(numteams, visible) {
          for (var i = 0; i < numteams; i++) {
              var sublistsize = 1;
              var elementId = 'team' + i;
              var obj = document.getElementById(elementId + '_' + sublistsize);
    Severity: Minor
    Found in app/assets/javascripts/grading.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                            if (visible) {
                                obj.style.display = '';
                                //E1877: changes made to adjust width of expandables
                                var offsets = obj.getBoundingClientRect();
                                obj.style.width = 'calc(100vw - 103px)';
      Severity: Major
      Found in app/assets/javascripts/grading.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                              if (!visible)
                                  collapseObj(obj, atag, header);
        Severity: Major
        Found in app/assets/javascripts/grading.js - About 45 mins to fix

          Function toggleTeam has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            function toggleTeam(elementId) {
                var sublistsize = 1;
                var obj = document.getElementById(elementId + '_' + sublistsize);
                var atag = document.getElementById(elementId + 'Link');
                var header = document.getElementById(elementId + '_header');
          Severity: Minor
          Found in app/assets/javascripts/grading.js - About 35 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

          There are no issues that match your filters.

          Category
          Status