public/mozilla-pdf/web/debugger.js

Summary

Maintainability
F
1 wk
Test Coverage

Function StepperClosure has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
Open

var Stepper = (function StepperClosure() {
  // Shorter way to create element and optionally set textContent.
  function c(tag, textContent) {
    var d = document.createElement(tag);
    if (textContent) {
Severity: Minor
Found in public/mozilla-pdf/web/debugger.js - About 1 day 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 debugger.js has 552 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* Copyright 2012 Mozilla Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
Severity: Major
Found in public/mozilla-pdf/web/debugger.js - About 1 day to fix

    Function StepperClosure has 183 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Stepper = (function StepperClosure() {
      // Shorter way to create element and optionally set textContent.
      function c(tag, textContent) {
        var d = document.createElement(tag);
        if (textContent) {
    Severity: Major
    Found in public/mozilla-pdf/web/debugger.js - About 7 hrs to fix

      Function FontInspectorClosure has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var FontInspector = (function FontInspectorClosure() {
        var fonts;
        var active = false;
        var fontAttribute = 'data-font-name';
        function removeSelection() {
      Severity: Major
      Found in public/mozilla-pdf/web/debugger.js - About 5 hrs to fix

        Function PDFBugClosure has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        var PDFBug = (function PDFBugClosure() {
          var panelWidth = 300;
          var buttons = [];
          var activePanel = null;
        
        
        Severity: Minor
        Found in public/mozilla-pdf/web/debugger.js - About 4 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 PDFBugClosure has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var PDFBug = (function PDFBugClosure() {
          var panelWidth = 300;
          var buttons = [];
          var activePanel = null;
        
        
        Severity: Major
        Found in public/mozilla-pdf/web/debugger.js - About 3 hrs to fix

          Function FontInspectorClosure has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          var FontInspector = (function FontInspectorClosure() {
            var fonts;
            var active = false;
            var fontAttribute = 'data-font-name';
            function removeSelection() {
          Severity: Minor
          Found in public/mozilla-pdf/web/debugger.js - About 3 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 StepperManagerClosure has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var StepperManager = (function StepperManagerClosure() {
            var steppers = [];
            var stepperDiv = null;
            var stepperControls = null;
            var stepperChooser = null;
          Severity: Major
          Found in public/mozilla-pdf/web/debugger.js - About 3 hrs to fix

            Function updateOperatorList has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                updateOperatorList: function updateOperatorList(operatorList) {
                  var self = this;
            
                  function cboxOnClick() {
                    var x = +this.dataset.idx;
            Severity: Major
            Found in public/mozilla-pdf/web/debugger.js - About 2 hrs to fix

              Function Stats has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var Stats = (function Stats() {
                var stats = [];
                function clear(node) {
                  while (node.hasChildNodes()) {
                    node.removeChild(node.lastChild);
              Severity: Major
              Found in public/mozilla-pdf/web/debugger.js - About 2 hrs to fix

                Function fontAdded has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    fontAdded: function fontAdded(fontObj, url) {
                      function properties(obj, list) {
                        var moreInfo = document.createElement('table');
                        for (var i = 0; i < list.length; i++) {
                          var tr = document.createElement('tr');
                Severity: Major
                Found in public/mozilla-pdf/web/debugger.js - About 2 hrs to fix

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

                  var StepperManager = (function StepperManagerClosure() {
                    var steppers = [];
                    var stepperDiv = null;
                    var stepperControls = null;
                    var stepperChooser = null;
                  Severity: Minor
                  Found in public/mozilla-pdf/web/debugger.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 Stats has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var Stats = (function Stats() {
                    var stats = [];
                    function clear(node) {
                      while (node.hasChildNodes()) {
                        node.removeChild(node.lastChild);
                  Severity: Minor
                  Found in public/mozilla-pdf/web/debugger.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 init has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      init: function init() {
                        /*
                         * Basic Layout:
                         * PDFBug
                         *  Controls
                  Severity: Minor
                  Found in public/mozilla-pdf/web/debugger.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  if (str.length > 0) {
                                    newArgs.push(str.join(''));
                                    str = [];
                                  }
                    Severity: Major
                    Found in public/mozilla-pdf/web/debugger.js - About 45 mins to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        function removeSelection() {
                          var divs = document.querySelectorAll('div[' + fontAttribute + ']');
                          for (var i = 0, ii = divs.length; i < ii; ++i) {
                            var div = divs[i];
                            div.className = '';
                      Severity: Major
                      Found in public/mozilla-pdf/web/debugger.js and 1 other location - About 2 hrs to fix
                      public/mozilla-pdf/web/debugger.js on lines 32..38

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 85.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        function resetSelection() {
                          var divs = document.querySelectorAll('div[' + fontAttribute + ']');
                          for (var i = 0, ii = divs.length; i < ii; ++i) {
                            var div = divs[i];
                            div.className = 'debuggerHideText';
                      Severity: Major
                      Found in public/mozilla-pdf/web/debugger.js and 1 other location - About 2 hrs to fix
                      public/mozilla-pdf/web/debugger.js on lines 25..31

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 85.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status