cfpb/owning-a-home

View on GitHub

Showing 154 of 154 total issues

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

  personal: function() {
    return [
      {
        text:        'I want more space (e.g., for a growing family).',
        grade:       null,
Severity: Minor
Found in src/static/js/modules/prepare-worksheets/worksheet-config.js - About 1 hr to fix

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

      function updateLoanDisplay() {
        $amount.text( formatUSD( positive( loan['amount-borrowed'] ), { decimalPlaces: 0 } ) );
        $closing.text( formatUSD( loan['closing-costs'], { decimalPlaces: 0 } ) );
        $downPayment.text( formatUSD( loan['down-payment'], { decimalPlaces: 0 } ) );
        $lenderFees.text( formatUSD( loan.discount + loan.processing, { decimalPlaces: 0 } ) );
    Severity: Minor
    Found in src/static/js/modules/formalize.js - About 1 hr to fix

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

        risks: function() {
          return [
            {
              text:        'My home value could decline and I could lose my equity',
              grade:       null,
      Severity: Minor
      Found in src/static/js/modules/prepare-worksheets/worksheet-config.js - About 1 hr to fix

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

            render: function () {
                var scenario = this.props.scenario;
                return (
                    <div>
                        <div className="content-l_col scenario-block">
        Severity: Minor
        Found in src/static/js/modules/loan-comparison/components/scenario-picker.js - About 1 hr to fix

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

            jumboCheck: function( loan ) {
              var newType;
              var loanType = loan['loan-type'];
          
              // make sure we have a previous type
          Severity: Minor
          Found in src/static/js/modules/loan-comparison/stores/loan-store.js - About 1 hr to fix

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

                render: function() {
                    var loan = this.props.loan;
                    var loanName = loan.name;
                    return (
                        <div className="mobile-overview">

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

                    var wrapProperty = function(object, prop){
                      var propType = typeof(object[prop]), descriptor = Object.getOwnPropertyDescriptor(object, prop);
                      if((prop==='getNotifier')||isAccessorDescriptor(descriptor)||(!descriptor.enumerable)){
                        return false;
                      }
              Severity: Minor
              Found in src/static/js/modules/object.observe-polyfill.js - About 1 hr to fix

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

                      self.deliverChangeRecords = function(){
                        var i = 0, l = _listeners.length,
                            //keepRunning = true, removed as it seems the actual implementation doesn't do this
                            // In response to BUG #5
                            retval;
                Severity: Minor
                Found in src/static/js/modules/object.observe-polyfill.js - About 1 hr to fix

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

                  function loadCounties() {
                  
                    // And request 'em.
                    var request = getCounties();
                    request.done( function( resp ) {
                  Severity: Minor
                  Found in src/static/js/modules/explore-rates.js - About 1 hr to fix

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

                            var loans = this.props.loans.map(function (loan) {
                                return (
                                    <LoanOutputCell loan={loan} prop={this.props.prop} resultType={this.props.resultType} />
                                )
                            }, this);
                    src/static/js/modules/loan-comparison/components/loan-input-table.js on lines 7..9

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

                    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

                            return (rows.map(function(prop){
                                return <LoanInputRow prop={prop} loans={this.props.loans} scenario={this.props.scenario}/>;
                            }, this))
                    src/static/js/modules/loan-comparison/components/loan-output-table-row.js on lines 41..45

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

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

                    function cloneForm( from, to ) {
                      if ( !( from = document.querySelector( from ) ) ) {
                        throw new Error( 'Source form not found on page.' );
                      }
                      if ( !( to = document.querySelector( to ) ) ) {
                    Severity: Minor
                    Found in src/static/js/modules/clone-form.js - About 55 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 Worksheet has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function Worksheet( options ) {
                      var _inputsList = {};
                      var _inputsGroupDOM;
                    
                      var _container = options.container;
                    Severity: Minor
                    Found in src/static/js/modules/prepare-worksheets/worksheet-controller.js - About 55 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 checkForJumbo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function checkForJumbo() {
                      var loan;
                      var jumbos = ['jumbo', 'agency', 'fha-hb', 'va-hb'];
                      var norms = [ 'conf', 'fha', 'va' ];
                      var warnings = {
                    Severity: Minor
                    Found in src/static/js/modules/explore-rates.js - About 55 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        Object.create = function create(prototype, properties) {
                    
                            var object;
                            function Type() {}  // An empty constructor.
                    
                    
                    Severity: Minor
                    Found in src/static/js/legacy/lte-ie8.js - About 55 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

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

                      flags: function() {
                        return {
                          title:         'Issue',
                          prompt:        'Is this likely?',
                          placeholder:   'Identify your own flag',
                    Severity: Major
                    Found in src/static/js/modules/prepare-worksheets/worksheet-config.js and 3 other locations - About 50 mins to fix
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 59..67
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 68..76
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 84..92

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

                    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

                      risks: function() {
                        return {
                          title:         'Issue',
                          prompt:        'Are you ready to accept this risk?',
                          placeholder:   'Identify your own risk',
                    Severity: Major
                    Found in src/static/js/modules/prepare-worksheets/worksheet-config.js and 3 other locations - About 50 mins to fix
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 59..67
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 68..76
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 93..101

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

                    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

                      personal: function() {
                        return {
                          title:         'Personal Goal',
                          prompt:        'Priority Level',
                          placeholder:   'Write your own goal',
                    Severity: Major
                    Found in src/static/js/modules/prepare-worksheets/worksheet-config.js and 3 other locations - About 50 mins to fix
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 68..76
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 84..92
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 93..101

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

                    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

                      financial: function() {
                        return {
                          title:         'Financial Goal',
                          prompt:        'Priority Level',
                          placeholder:   'Write your own goal',
                    Severity: Major
                    Found in src/static/js/modules/prepare-worksheets/worksheet-config.js and 3 other locations - About 50 mins to fix
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 59..67
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 84..92
                    src/static/js/modules/prepare-worksheets/worksheet-config.js on lines 93..101

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

                    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
                      Severity
                      Category
                      Status
                      Source
                      Language