gitweb/static/js/blame_incremental.js

Summary

Maintainability
D
3 days
Test Coverage

Function handleLine has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

function handleLine(commit, group) {
    /*
       This is the structure of the HTML fragment we are working
       with:

Severity: Minor
Found in gitweb/static/js/blame_incremental.js - About 6 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

File blame_incremental.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// Copyright (C) 2007, Fredrik Kuivinen <frekui@gmail.com>
//               2007, Petr Baudis <pasky@suse.cz>
//          2008-2011, Jakub Narebski <jnareb@gmail.com>

/**
Severity: Minor
Found in gitweb/static/js/blame_incremental.js - About 4 hrs to fix

    Function handleLine has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function handleLine(commit, group) {
        /*
           This is the structure of the HTML fragment we are working
           with:
    
    
    Severity: Major
    Found in gitweb/static/js/blame_incremental.js - About 2 hrs to fix

      Function processBlameLines has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      function processBlameLines(lines) {
          var match;
      
          for (var i = 0, len = lines.length; i < len; i++) {
      
      
      Severity: Minor
      Found in gitweb/static/js/blame_incremental.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 processBlameLines has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function processBlameLines(lines) {
          var match;
      
          for (var i = 0, len = lines.length; i < len; i++) {
      
      
      Severity: Major
      Found in gitweb/static/js/blame_incremental.js - About 2 hrs to fix

        Function handleResponse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function handleResponse(xhr, fromTimer) {
        
            /*
             * xhr.readyState
             *
        Severity: Minor
        Found in gitweb/static/js/blame_incremental.js - About 1 hr to fix

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

          function handleResponse(xhr, fromTimer) {
          
              /*
               * xhr.readyState
               *
          Severity: Minor
          Found in gitweb/static/js/blame_incremental.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 fixColorsAndGroups has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function fixColorsAndGroups() {
              var colorClasses = ['light', 'dark'];
              var linenum = 1;
              var tr, prev_group;
              var colorClass = 0;
          Severity: Minor
          Found in gitweb/static/js/blame_incremental.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 (!('previous' in curCommit)) {
                              var parts = data.split(' ', 2);
                              curCommit.previous    = parts[0];
                              curCommit.file_parent = unquote(parts[1]);
                          }
          Severity: Major
          Found in gitweb/static/js/blame_incremental.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if (fragment) {
                                    td_sha1.appendChild(fragment);
                                }
            Severity: Major
            Found in gitweb/static/js/blame_incremental.js - About 45 mins to fix

              Avoid too many return statements within this function.
              Open

                      return;
              Severity: Major
              Found in gitweb/static/js/blame_incremental.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return;
                Severity: Major
                Found in gitweb/static/js/blame_incremental.js - About 30 mins to fix

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

                  function updateProgressInfo() {
                      if (!div_progress_info) {
                          div_progress_info = document.getElementById('progress_info');
                      }
                      if (!div_progress_bar) {
                  Severity: Minor
                  Found in gitweb/static/js/blame_incremental.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

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

                  function findColorNo(tr_prev, tr_next) {
                      var color_prev = getColorNo(tr_prev);
                      var color_next = getColorNo(tr_next);
                  
                  
                  
                  Severity: Minor
                  Found in gitweb/static/js/blame_incremental.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

                  There are no issues that match your filters.

                  Category
                  Status