cfpb/owning-a-home

View on GitHub

Showing 154 of 154 total issues

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

function updateView() {
  chart.startLoading();

  // reset view
  dropdown( [ 'county', 'loan-term' ] ).hideHighlight();
Severity: Major
Found in src/static/js/modules/explore-rates.js - About 3 hrs to fix

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

    function Notification( element ) { // eslint-disable-line max-statements, inline-comments, max-len
    
      var BASE_CLASS = 'm-notification';
    
      // Constants for the state of this Notification.
    Severity: Major
    Found in src/static/js/modules/notification.js - About 3 hrs to fix

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

      function Worksheet( options ) {
        var _inputsList = {};
        var _inputsGroupDOM;
      
        var _container = options.container;
      Severity: Major
      Found in src/static/js/modules/prepare-worksheets/worksheet-controller.js - About 2 hrs to fix

        File common.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        var common = {};
        
        common.loanCount = 2;
        Severity: Minor
        Found in src/static/js/modules/loan-comparison/common.js - About 2 hrs to fix

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

            function polyfillElement(elem) {
              // If the element is already polyfilled, skip it
              if (elem.__placeholder != null) {
                // Make sure that if the placeholder is already shown, that it is at least up-to-date
                if (elem.__placeholder) {
          Severity: Major
          Found in src/static/js/modules/placeholder-polyfill.js - About 2 hrs to fix

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

            var utils = function( id ) {
            
              var $el;
            
              if ( !id ) {
            Severity: Minor
            Found in src/static/js/modules/dropdown-utils.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 processCounty has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function processCounty() {
              var $counties = $( '#county' );
              var $county = $( '#county' ).find( ':selected' );
              var $loan = dropdown( 'loan-type' );
              var norms = [ 'conf', 'fha', 'va' ];
            Severity: Major
            Found in src/static/js/modules/explore-rates.js - About 2 hrs to fix

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

              function Notification( element ) { // eslint-disable-line max-statements, inline-comments, max-len
              
                var BASE_CLASS = 'm-notification';
              
                // Constants for the state of this Notification.
              Severity: Minor
              Found in src/static/js/modules/notification.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

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

                  }, {
                    name:   'interest-fees-paid',
                    source: function() {
                      return cost( {
                        amountBorrowed: positive( loan['amount-borrowed'] ),
              Severity: Major
              Found in src/static/js/modules/formalize.js and 2 other locations - About 2 hrs to fix
              src/static/js/modules/formalize.js on lines 149..160
              src/static/js/modules/formalize.js on lines 171..182

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

              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 3 locations. Consider refactoring.
              Open

                  }, {
                    name:   'principal-paid',
                    source: function() {
                      return cost( {
                        amountBorrowed: positive( loan['amount-borrowed'] ),
              Severity: Major
              Found in src/static/js/modules/formalize.js and 2 other locations - About 2 hrs to fix
              src/static/js/modules/formalize.js on lines 160..171
              src/static/js/modules/formalize.js on lines 171..182

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

              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 3 locations. Consider refactoring.
              Open

                  }, {
                    name:   'overall-cost',
                    source: function() {
                      return cost( {
                        amountBorrowed: positive( loan['amount-borrowed'] ),
              Severity: Major
              Found in src/static/js/modules/formalize.js and 2 other locations - About 2 hrs to fix
              src/static/js/modules/formalize.js on lines 149..160
              src/static/js/modules/formalize.js on lines 160..171

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

              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

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

              function InputGraded( options ) {
                // TODO see if bind() can be used in place of _self = this.
                // Note bind()'s lack of IE8 support.
                var _self = this;
                // Load our handlebar templates.
              Severity: Major
              Found in src/static/js/modules/prepare-worksheets/inputs/input-graded.js - About 2 hrs to fix

                File worksheet-config.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                var gradedInput = require( './inputs/input-graded' );
                var notesInput = require( './inputs/input-notes' );
                var editorTemplate =
                Severity: Minor
                Found in src/static/js/modules/prepare-worksheets/worksheet-config.js - About 2 hrs to fix

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

                    Array.prototype.indexOf = function(searchElement, fromIndex) {
                  
                      var k;
                  
                      // 1. Let O be the result of calling ToObject passing
                  Severity: Minor
                  Found in src/static/js/legacy/lte-ie8.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 2 locations. Consider refactoring.
                  Open

                    if ( hash !== '' && $expandable.length && !$expandable.hasClass( 'expandable__expanded' ) ) {
                      $expandable.find( '.expandable_target' )[0].click();
                      $.scrollTo( $el, {
                        duration: 600,
                        offset:   -30
                  Severity: Major
                  Found in src/static/js/modules/loan-options.js and 1 other location - About 2 hrs to fix
                  src/static/js/modules/process.js on lines 23..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 80.

                  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 2 locations. Consider refactoring.
                  Open

                    if ( hash !== '' &&
                         $expandable.length &&
                         !$expandable.hasClass( 'expandable__expanded' ) ) {
                      $expandable.find( '.expandable_target' )[0].click();
                      $.scrollTo( $el, {
                  Severity: Major
                  Found in src/static/js/modules/process.js and 1 other location - About 2 hrs to fix
                  src/static/js/modules/loan-options.js on lines 83..89

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

                  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

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

                  function processCounty() {
                    var $counties = $( '#county' );
                    var $county = $( '#county' ).find( ':selected' );
                    var $loan = dropdown( 'loan-type' );
                    var norms = [ 'conf', 'fha', 'va' ];
                  Severity: Minor
                  Found in src/static/js/modules/explore-rates.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 render has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      render: function () {
                          var tooltipHtml = common.outputTooltips[this.props.prop]
                                            ? <Tooltip text={common.outputTooltips[this.props.prop]}/>
                                            : null;
                          var headingType = function (prop, type, label, scenario) {

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

                    function checkForJumbo() {
                      var loan;
                      var jumbos = ['jumbo', 'agency', 'fha-hb', 'va-hb'];
                      var norms = [ 'conf', 'fha', 'va' ];
                      var warnings = {
                    Severity: Major
                    Found in src/static/js/modules/explore-rates.js - About 2 hrs to fix

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

                      function EmailSignup( element ) {
                        var UNDEFINED;
                        var _baseElement = $(element);
                        var _formElement = _baseElement.find( 'form' );
                        var _emailElement = _formElement.find( 'input[type="email"]' );
                      Severity: Minor
                      Found in src/static/js/modules/email-signup.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language