cfpb/owning-a-home

View on GitHub

Showing 154 of 154 total issues

Avoid deeply nested control flow statements.
Open

              if(_listeners[i]===console.log){
                console.log(currentUpdates);
              }else{
                _listeners[i](currentUpdates);
              }
Severity: Major
Found in src/static/js/modules/object.observe-polyfill.js - About 45 mins to fix

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

    function checkARM() {
      // reset warning and info
      $( '#arm-warning' ).addClass( 'hidden' );
      $( '.arm-info' ).addClass( 'hidden' );
      var disallowedTypes = [ 'fha', 'va', 'va-hb', 'fha-hb' ];
    Severity: Minor
    Found in src/static/js/modules/explore-rates.js - About 45 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

    Avoid deeply nested control flow statements.
    Open

                if ( expandable.has( $this ).length > 0 &&
                     expandableOffsetTop < parentOffsetTop ) {
                  $this.hide();
                }
    Severity: Major
    Found in src/static/js/modules/loan-comparison/position-notes.js - About 45 mins to fix

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

          if ( length < 180 ) {
            shortTermVal.push( {
              rate:     parseFloat( rate ),
              interest: parseFloat( totalInterest ),
              term:     length / 12
      Severity: Minor
      Found in src/static/js/modules/explore-rates.js and 1 other location - About 45 mins to fix
      src/static/js/modules/explore-rates.js on lines 773..780

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

      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

      Avoid deeply nested control flow statements.
      Open

                    if(values[idx] !== value){
                      if(queueUpdates){
                        self.queueUpdate(object, prop, 'update', values[idx], value);
                      }
                      values[idx] = value;
      Severity: Major
      Found in src/static/js/modules/object.observe-polyfill.js - About 45 mins to fix

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

        formExplainer.resizeImage = function( els, $window, windowResize ) {
        
          var pageWidth = els.$page.width();
          var $image = els.$imageMapImage;
          var currentHeight = $image.height();
        Severity: Minor
        Found in src/static/js/modules/form-explainer.js - About 45 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

        Avoid deeply nested control flow statements.
        Open

                      for (var j = 0, updatesLength = _updates.length; j < updatesLength; j++) {
                        if (_acceptLists[i].indexOf(_updates[j].type) !== -1) {
                          currentUpdates.push(_updates[j]);
                        }
                      }
        Severity: Major
        Found in src/static/js/modules/object.observe-polyfill.js - About 45 mins to fix

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

              } else {
                longTermVal.push( {
                  rate:     parseFloat( rate ),
                  interest: parseFloat( totalInterest ),
                  term:     length / 12
          Severity: Minor
          Found in src/static/js/modules/explore-rates.js and 1 other location - About 45 mins to fix
          src/static/js/modules/explore-rates.js on lines 766..773

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

          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 loadPage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          function loadPage( lastPage, pageNum ) {
            formExplainer.currentPage = pageNum;
            $( '.form-explainer_page-link' ).removeClass( 'current-page' );
            $( '.form-explainer_page-link[data-page=' + pageNum + ']' ).addClass( 'current-page' );
          
          
          Severity: Minor
          Found in src/static/js/modules/form-explainer.js - About 45 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 exports has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function( grunt ) {
          
            'use strict';
          
            var path = require( 'path' );
          Severity: Minor
          Found in Gruntfile.js - About 45 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

          Avoid deeply nested control flow statements.
          Open

                              if field_name in custom_fields:
                                  if field == 'link':
                                      tool[field] = \
                                          {'url': custom_fields[field_name][0],
                                           'label': custom_fields[field_name][1]}
          Severity: Major
          Found in src/_lib/wordpress_journey_processor.py - About 45 mins to fix

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

            monthly.takeHomeIncomeTotal = function( data ) {
              return parseFloat( data.takeHomeIncome || 0 ) +
                     parseFloat( data.takeHomeIncomeCB || 0 );
            };
            Severity: Major
            Found in src/static/js/modules/monthly-payment-calc.js and 3 other locations - About 40 mins to fix
            src/static/js/modules/monthly-payment-calc.js on lines 5..8
            src/static/js/modules/monthly-payment-calc.js on lines 25..28
            src/static/js/modules/monthly-payment-calc.js on lines 35..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 48.

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

            monthly.homeMaintenanceAndImprovement = function( data ) {
              return parseFloat( data.homeImprovement || 0 ) +
                     parseFloat( data.homeMaintenance || 0 );
            };
            Severity: Major
            Found in src/static/js/modules/monthly-payment-calc.js and 3 other locations - About 40 mins to fix
            src/static/js/modules/monthly-payment-calc.js on lines 5..8
            src/static/js/modules/monthly-payment-calc.js on lines 10..13
            src/static/js/modules/monthly-payment-calc.js on lines 35..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 48.

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

            monthly.preTaxIncomeTotal = function( data ) {
              return parseFloat( data.preTaxIncome || 0 ) +
                     parseFloat( data.preTaxIncomeCB || 0 );
            };
            Severity: Major
            Found in src/static/js/modules/monthly-payment-calc.js and 3 other locations - About 40 mins to fix
            src/static/js/modules/monthly-payment-calc.js on lines 10..13
            src/static/js/modules/monthly-payment-calc.js on lines 25..28
            src/static/js/modules/monthly-payment-calc.js on lines 35..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 48.

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

            monthly.futureSavings = function( data ) {
              return parseFloat( data.emergencySavings || 0 ) +
                     parseFloat( data.longTermSavings || 0 );
            };
            Severity: Major
            Found in src/static/js/modules/monthly-payment-calc.js and 3 other locations - About 40 mins to fix
            src/static/js/modules/monthly-payment-calc.js on lines 5..8
            src/static/js/modules/monthly-payment-calc.js on lines 10..13
            src/static/js/modules/monthly-payment-calc.js on lines 25..28

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

            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

                if ( disallowedTerms.indexOf( params['loan-term'] ) !== -1 ) {
                  dropdown( 'loan-term' ).reset();
                  dropdown( 'loan-term' ).showHighlight();
                  $( '#arm-warning' ).removeClass( 'hidden' );
                }
            Severity: Minor
            Found in src/static/js/modules/explore-rates.js and 1 other location - About 35 mins to fix
            src/static/js/modules/explore-rates.js on lines 825..829

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

            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

                                <span className="expandable_cue-close">
                                    <span>Hide </span>
                                    <span className="cf-icon cf-icon-minus-round"></span>
                                </span>
            src/static/js/modules/loan-comparison/components/loan-output-table-row.js on lines 97..100

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

            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

                if ( disallowedTypes.indexOf( params['loan-type'] ) !== -1 ) {
                  dropdown( 'loan-type' ).reset();
                  dropdown( 'loan-type' ).showHighlight();
                  $( '#arm-warning' ).removeClass( 'hidden' );
                }
            Severity: Minor
            Found in src/static/js/modules/explore-rates.js and 1 other location - About 35 mins to fix
            src/static/js/modules/explore-rates.js on lines 819..823

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

            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

                                <span className="expandable_cue-open">
                                    <span>Show </span>
                                    <span className="cf-icon cf-icon-plus-round"></span>
                                </span>
            src/static/js/modules/loan-comparison/components/loan-output-table-row.js on lines 101..104

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

            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 _getStorageType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function _getStorageType( storage ) {
              // Use default setting if none is provided.
              if ( typeof storage !== 'object' ) {
                if ( typeof _storage === 'undefined' ) {
                  try {
            Severity: Minor
            Found in src/static/js/modules/web-storage-proxy.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

            Severity
            Category
            Status
            Source
            Language