18F/18f.gsa.gov

View on GitHub

Showing 104 of 104 total issues

Function ajaxChimp has 85 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.ajaxChimp = function (options) {
        $(this).each(function(i, elem) {
            var form = $(elem);
            var email = form.find('input[type=email]');
            var label = form.find('label[for=' + email.attr('id') + ']');
Severity: Major
Found in assets/js/lib/jquery.ajaxchimp.js - About 3 hrs to fix

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

    var disable = function disable(el) {
      var _getComboBoxContext = getComboBoxContext(el),
          inputEl = _getComboBoxContext.inputEl,
          toggleListBtnEl = _getComboBoxContext.toggleListBtnEl,
          clearInputBtnEl = _getComboBoxContext.clearInputBtnEl;
    Severity: Major
    Found in _sass/_libs/uswds/js/uswds.js and 1 other location - About 3 hrs to fix
    _sass/_libs/uswds/js/uswds.js on lines 1621..1631

    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 101.

    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

    var enable = function enable(el) {
      var _getComboBoxContext2 = getComboBoxContext(el),
          inputEl = _getComboBoxContext2.inputEl,
          toggleListBtnEl = _getComboBoxContext2.toggleListBtnEl,
          clearInputBtnEl = _getComboBoxContext2.clearInputBtnEl;
    Severity: Major
    Found in _sass/_libs/uswds/js/uswds.js and 1 other location - About 3 hrs to fix
    _sass/_libs/uswds/js/uswds.js on lines 1603..1613

    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 101.

    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

    Method related_posts has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def related_posts(me, posts)
          return [] unless posts.docs.size > 1
          highest_freq = @tag_freq.values.max
          related_scores = Hash.new(0)
    
    
    Severity: Minor
    Found in _plugins/related_posts.rb - 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 getElementParams has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          function getElementParams(node) {
              var computedStyle = getComputedStyle(node),
                  parentNode = node.parentNode,
                  parentComputedStyle = getComputedStyle(parentNode),
                  cachedPosition = node.style.position;
    Severity: Major
    Found in assets/js/sticky.js - About 3 hrs to fix

      Function 19 has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      },{"../config":28,"../events":29,"../utils/behavior":35}],19:[function(require,module,exports){
      "use strict";
      
      function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
      
      
      Severity: Major
      Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

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

        },{}],8:[function(require,module,exports){
        "use strict";
        
        function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
        
        
        Severity: Minor
        Found in _sass/_libs/uswds/js/uswds.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 3 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

        },{}],3:[function(require,module,exports){
        'use strict'; // <3 Modernizr
        // https://raw.githubusercontent.com/Modernizr/Modernizr/master/feature-detects/dom/dataset.js
        
        function useNative() {
        Severity: Minor
        Found in _sass/_libs/uswds/js/uswds.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 7 has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{}],7:[function(require,module,exports){
        /*
        object-assign
        (c) Sindre Sorhus
        @license MIT
        Severity: Major
        Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

          Function 17 has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{}],17:[function(require,module,exports){
          "use strict";
          
          function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
          
          
          Severity: Major
          Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

            Function 4 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            },{}],4:[function(require,module,exports){
            "use strict";
            
            // element-closest | CC0-1.0 | github.com/jonathantneal/closest
            (function (ElementProto) {
            Severity: Minor
            Found in _sass/_libs/uswds/js/uswds.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 8 has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{}],8:[function(require,module,exports){
            "use strict";
            
            function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
            
            
            Severity: Major
            Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

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

              },{"../config":28,"../events":29,"../utils/behavior":35,"../utils/toggle-form-input":40}],25:[function(require,module,exports){
              "use strict";
              
              function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
              
              
              Severity: Major
              Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

                Function 36 has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                },{"object-assign":7,"receptor/behavior":8}],36:[function(require,module,exports){
                "use strict";
                
                var assign = require("object-assign");
                
                
                Severity: Major
                Found in _sass/_libs/uswds/js/uswds.js - About 2 hrs to fix

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

                  },{}],5:[function(require,module,exports){
                  "use strict";
                  
                  /* global define, KeyboardEvent, module */
                  (function () {
                  Severity: Minor
                  Found in _sass/_libs/uswds/js/uswds.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 16 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  },{}],16:[function(require,module,exports){
                  'use strict';
                  
                  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
                  
                  
                  Severity: Minor
                  Found in _sass/_libs/uswds/js/uswds.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

                  Identical blocks of code found in 9 locations. Consider refactoring.
                  Open

                  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
                  Severity: Major
                  Found in _sass/_libs/uswds/js/uswds.js and 8 other locations - About 1 hr to fix
                  _sass/_libs/uswds/js/uswds.js on lines 1225..1225
                  _sass/_libs/uswds/js/uswds.js on lines 1337..1337
                  _sass/_libs/uswds/js/uswds.js on lines 1360..1360
                  _sass/_libs/uswds/js/uswds.js on lines 1483..1483
                  _sass/_libs/uswds/js/uswds.js on lines 2188..2188
                  _sass/_libs/uswds/js/uswds.js on lines 2288..2288
                  _sass/_libs/uswds/js/uswds.js on lines 2436..2436
                  _sass/_libs/uswds/js/uswds.js on lines 2460..2460

                  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 74.

                  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

                  Identical blocks of code found in 9 locations. Consider refactoring.
                  Open

                  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
                  Severity: Major
                  Found in _sass/_libs/uswds/js/uswds.js and 8 other locations - About 1 hr to fix
                  _sass/_libs/uswds/js/uswds.js on lines 1225..1225
                  _sass/_libs/uswds/js/uswds.js on lines 1337..1337
                  _sass/_libs/uswds/js/uswds.js on lines 1360..1360
                  _sass/_libs/uswds/js/uswds.js on lines 1483..1483
                  _sass/_libs/uswds/js/uswds.js on lines 2188..2188
                  _sass/_libs/uswds/js/uswds.js on lines 2436..2436
                  _sass/_libs/uswds/js/uswds.js on lines 2460..2460
                  _sass/_libs/uswds/js/uswds.js on lines 2551..2551

                  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 74.

                  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

                  Identical blocks of code found in 9 locations. Consider refactoring.
                  Open

                  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
                  Severity: Major
                  Found in _sass/_libs/uswds/js/uswds.js and 8 other locations - About 1 hr to fix
                  _sass/_libs/uswds/js/uswds.js on lines 1225..1225
                  _sass/_libs/uswds/js/uswds.js on lines 1337..1337
                  _sass/_libs/uswds/js/uswds.js on lines 1360..1360
                  _sass/_libs/uswds/js/uswds.js on lines 2188..2188
                  _sass/_libs/uswds/js/uswds.js on lines 2288..2288
                  _sass/_libs/uswds/js/uswds.js on lines 2436..2436
                  _sass/_libs/uswds/js/uswds.js on lines 2460..2460
                  _sass/_libs/uswds/js/uswds.js on lines 2551..2551

                  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 74.

                  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

                  Identical blocks of code found in 9 locations. Consider refactoring.
                  Open

                  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
                  Severity: Major
                  Found in _sass/_libs/uswds/js/uswds.js and 8 other locations - About 1 hr to fix
                  _sass/_libs/uswds/js/uswds.js on lines 1225..1225
                  _sass/_libs/uswds/js/uswds.js on lines 1337..1337
                  _sass/_libs/uswds/js/uswds.js on lines 1360..1360
                  _sass/_libs/uswds/js/uswds.js on lines 1483..1483
                  _sass/_libs/uswds/js/uswds.js on lines 2288..2288
                  _sass/_libs/uswds/js/uswds.js on lines 2436..2436
                  _sass/_libs/uswds/js/uswds.js on lines 2460..2460
                  _sass/_libs/uswds/js/uswds.js on lines 2551..2551

                  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 74.

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language