cfpb/owning-a-home

View on GitHub

Showing 154 of 154 total issues

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

                      <div className="content-l input-row">
                        <div className="label-col">
                          <label htmlFor="condoHOA">
                            Condo/HOA fees
                          </label>
Severity: Major
Found in src/static/js/modules/monthly-payment-worksheet.js and 11 other locations - About 5 hrs to fix
src/static/js/modules/monthly-payment-worksheet.js on lines 147..159
src/static/js/modules/monthly-payment-worksheet.js on lines 160..172
src/static/js/modules/monthly-payment-worksheet.js on lines 173..185
src/static/js/modules/monthly-payment-worksheet.js on lines 186..198
src/static/js/modules/monthly-payment-worksheet.js on lines 232..244
src/static/js/modules/monthly-payment-worksheet.js on lines 245..257
src/static/js/modules/monthly-payment-worksheet.js on lines 277..289
src/static/js/modules/monthly-payment-worksheet.js on lines 290..302
src/static/js/modules/monthly-payment-worksheet.js on lines 353..365
src/static/js/modules/monthly-payment-worksheet.js on lines 366..378
src/static/js/modules/monthly-payment-worksheet.js on lines 379..391

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

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

File Gruntfile.js has 391 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module.exports = function( grunt ) {

  'use strict';

  var path = require( 'path' );
Severity: Minor
Found in Gruntfile.js - About 5 hrs to fix

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

                          <div className="total-row output-row">
                            <div className="content-l">
                              <div className="label-col">
                                <div className="label">
                                  Total monthly spending and savings
    Severity: Major
    Found in src/static/js/modules/monthly-payment-worksheet.js and 1 other location - About 5 hrs to fix
    src/static/js/modules/monthly-payment-worksheet.js on lines 530..544

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

    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

                        <div className="total-row output-row summary-row">
                          <div className="content-l">
                            <div className="label-col">
                              <div className="label">
                                Estimated monthly principal and interest
    Severity: Major
    Found in src/static/js/modules/monthly-payment-worksheet.js and 1 other location - About 5 hrs to fix
    src/static/js/modules/monthly-payment-worksheet.js on lines 200..215

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

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

    function createNewForm( id, loanData ) {
    
      var loan = objectify( '#lc-input-' + id, [
        {
          name:   'amount-borrowed',
    Severity: Minor
    Found in src/static/js/modules/formalize.js - About 5 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

    Consider simplifying this complex logical expression.
    Open

    if(supportsAccessors && !Object.observe){
      (function(extend, global){
        var isCallable = (function(toString){
            var s = toString.call(toString),
                u = typeof u;
    Severity: Critical
    Found in src/static/js/modules/object.observe-polyfill.js - About 5 hrs to fix

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

      var utils = function( id ) {
      
        var $el;
      
        if ( !id ) {
      Severity: Major
      Found in src/static/js/modules/dropdown-utils.js - About 4 hrs to fix

        File formalize.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        var $ = require( 'jquery' );
        var debounce = require( 'debounce' );
        var cost = require( 'overall-loan-cost' );
        Severity: Minor
        Found in src/static/js/modules/formalize.js - About 4 hrs to fix

          File loan-store.js has 363 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var $ = require( 'jquery' );
          var assign = require( 'object-assign' );
          
          
          Severity: Minor
          Found in src/static/js/modules/loan-comparison/stores/loan-store.js - About 4 hrs to fix

            LoanStore has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            var LoanStore = assign( {}, EventEmitter.prototype, {
            
              _loans: [],
            
              downpaymentConstant: 'downpayment-percent',
            Severity: Minor
            Found in src/static/js/modules/loan-comparison/stores/loan-store.js - About 4 hrs to fix

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

              function renderChart( data, cb ) {
                if ( chart.isInitialized ) {
              
                  var hc = chart.$el.highcharts();
              
              
              Severity: Major
              Found in src/static/js/modules/explore-rates.js - About 4 hrs to fix

                File form-explainer.js has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                var $ = jQuery = require('jquery');
                var sticky = require('../../vendor/sticky/jquery.sticky.js');
                require('../../vendor/jquery.easing/jquery.easing.js');
                Severity: Minor
                Found in src/static/js/modules/form-explainer.js - About 4 hrs to fix

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

                                      <div className="content-l output-row">
                                        <div className="label-col">
                                          <div className="label">Debts</div>
                                        </div>
                                        <div className="input-col">
                  Severity: Major
                  Found in src/static/js/modules/monthly-payment-worksheet.js and 1 other location - About 3 hrs to fix
                  src/static/js/modules/monthly-payment-worksheet.js on lines 437..446

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

                  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

                                      <div className="content-l output-row">
                                        <div className="label-col">
                                          <div className="label">Living expenses</div>
                                        </div>
                                        <div className="input-col">
                  Severity: Major
                  Found in src/static/js/modules/monthly-payment-worksheet.js and 1 other location - About 3 hrs to fix
                  src/static/js/modules/monthly-payment-worksheet.js on lines 427..436

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

                  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 fetch( params ) {
                    var today = new Date();
                    var decache = '' + today.getDate() + today.getMonth();
                  
                    return $.ajax( {
                  Severity: Major
                  Found in src/static/js/modules/rates.js and 1 other location - About 3 hrs to fix
                  src/static/js/modules/mortgage-insurance.js on lines 15..27

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

                  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 fetch( params ) {
                    var today = new Date();
                    var decache = '' + today.getDate() + today.getMonth();
                  
                    return $.ajax( {
                  Severity: Major
                  Found in src/static/js/modules/mortgage-insurance.js and 1 other location - About 3 hrs to fix
                  src/static/js/modules/rates.js on lines 15..26

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

                  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

                  File object.observe-polyfill.js has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  var supportsAccessors = require('./supports-accessors');
                  
                  // The polyfill below is from https://github.com/jdarling/Object.observe
                  
                  /*
                  Severity: Minor
                  Found in src/static/js/modules/object.observe-polyfill.js - About 3 hrs to fix

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

                                        <div className="content-l output-row">
                                          <div className="label-col">
                                            <div className="label">Total available for monthly housing obligations</div>
                                          </div>
                                          <div className="input-col">
                    Severity: Major
                    Found in src/static/js/modules/monthly-payment-worksheet.js and 2 other locations - About 3 hrs to fix
                    src/static/js/modules/monthly-payment-worksheet.js on lines 419..426
                    src/static/js/modules/monthly-payment-worksheet.js on lines 509..518

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

                    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

                                        <div className="content-l output-row">
                                          <div className="label-col">
                                            <div className="label">Take-home income</div>
                                          </div>
                                          <div className="input-col">
                    Severity: Major
                    Found in src/static/js/modules/monthly-payment-worksheet.js and 2 other locations - About 3 hrs to fix
                    src/static/js/modules/monthly-payment-worksheet.js on lines 487..494
                    src/static/js/modules/monthly-payment-worksheet.js on lines 509..518

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

                    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

                                          <div className="content-l">
                                            <div className="label-col">
                                              <div className="label">
                                                Estimated total monthly payment*
                                              </div>
                    Severity: Major
                    Found in src/static/js/modules/monthly-payment-worksheet.js and 2 other locations - About 3 hrs to fix
                    src/static/js/modules/monthly-payment-worksheet.js on lines 419..426
                    src/static/js/modules/monthly-payment-worksheet.js on lines 487..494

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

                    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