cfpb/owning-a-home

View on GitHub

Showing 154 of 154 total issues

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

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

    function renderChart( data, cb ) {
      if ( chart.isInitialized ) {
    
        var hc = chart.$el.highcharts();
    
    
    Severity: Minor
    Found in src/static/js/modules/explore-rates.js - About 1 hr 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 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render: function() {
            return (
              <div>
                <div>
                    <ScenarioSection scenario={this.state.scenario}/>
    Severity: Minor
    Found in src/static/js/modules/loan-comparison/components/app.js - About 1 hr to fix

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

      function ButtonGradingGroup( options ) {
        // TODO see if bind() can be used in place of _self = this.
        // Note bind()'s lack of IE8 support.
        var _self = this;
      
      

        Function jumboCheck has a Cognitive Complexity of 14 (exceeds 5 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

        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

          function hide() {
            $el.each( function() {
              var $container = $( '.' + $( this ).attr( 'id' ) );
              $container.addClass( 'hidden' );
            } );
        Severity: Major
        Found in src/static/js/modules/dropdown-utils.js and 3 other locations - About 1 hr to fix
        src/static/js/modules/dropdown-utils.js on lines 143..150
        src/static/js/modules/dropdown-utils.js on lines 169..176
        src/static/js/modules/dropdown-utils.js on lines 182..189

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

        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

          function hideLoading() {
            $el.each( function() {
              var $container = $( '.' + $( this ).attr( 'id' ) );
              $container.removeClass( 'loading' );
            } );
        Severity: Major
        Found in src/static/js/modules/dropdown-utils.js and 3 other locations - About 1 hr to fix
        src/static/js/modules/dropdown-utils.js on lines 143..150
        src/static/js/modules/dropdown-utils.js on lines 156..163
        src/static/js/modules/dropdown-utils.js on lines 169..176

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

        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

          function showLoading() {
            $el.each( function() {
              var $container = $( '.' + $( this ).attr( 'id' ) );
              $container.addClass( 'loading' );
            } );
        Severity: Major
        Found in src/static/js/modules/dropdown-utils.js and 3 other locations - About 1 hr to fix
        src/static/js/modules/dropdown-utils.js on lines 143..150
        src/static/js/modules/dropdown-utils.js on lines 156..163
        src/static/js/modules/dropdown-utils.js on lines 182..189

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

        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

          function show() {
            $el.each( function() {
              var $container = $( '.' + $( this ).attr( 'id' ) );
              $container.removeClass( 'hidden' );
            } );
        Severity: Major
        Found in src/static/js/modules/dropdown-utils.js and 3 other locations - About 1 hr to fix
        src/static/js/modules/dropdown-utils.js on lines 156..163
        src/static/js/modules/dropdown-utils.js on lines 169..176
        src/static/js/modules/dropdown-utils.js on lines 182..189

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

        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 _checkPropertyListing has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              self._checkPropertyListing = function(dontQueueUpdates){
                var object = self._watching, keys = Object.keys(object), i=0, l=keys.length;
                var newKeys = [], oldKeys = properties.slice(0), updates = [];
                var prop, queueUpdates = !dontQueueUpdates, propType, value, idx, aLength;
        
        
        Severity: Minor
        Found in src/static/js/modules/object.observe-polyfill.js - About 1 hr to fix

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

                          <div className="content-l">
                              <div className="content-l_col content-l_col-3-4">
                                  <h3><span className="round-step">3</span>See how different factors affect your projected costs</h3>
                              </div>
                          </div>
          Severity: Major
          Found in src/static/js/modules/loan-comparison/components/app.js and 1 other location - About 1 hr to fix
          src/static/js/modules/loan-comparison/components/app.js on lines 145..149

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

          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">
                              <div className="content-l_col content-l_col-3-4">
                                  <h3><span className="round-step">4</span>Next steps</h3>
                              </div>
                          </div>
          Severity: Major
          Found in src/static/js/modules/loan-comparison/components/app.js and 1 other location - About 1 hr to fix
          src/static/js/modules/loan-comparison/components/app.js on lines 137..141

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

          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 render has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              render: function() { 
                  var className = "lc-inputs", headerText;
          
                  // if editing a loan, add classes so the inputs will show on mobile
                  if (this.props.editing) {

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

            function _loadSummary() {
              var pageTemplate = require( '../../templates/prepare-worksheets/page-summary.hbs' );
              var summarySection = require( '../../templates/prepare-worksheets/page-summary-section.hbs' );
              var summaryError = require( '../../templates/prepare-worksheets/page-summary-error.hbs' );
              Handlebars.registerPartial( {
            Severity: Minor
            Found in src/static/js/modules/prepare-worksheets/prepare-worksheets.js - About 1 hr to fix

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

              function EventObserver() {
              
                // The events registered on this instance.
                var _events = {};
              
              
              Severity: Minor
              Found in src/static/js/modules/prepare-worksheets/util/event-observer.js - About 1 hr 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 2 locations. Consider refactoring.
              Open

                                          <LoanOutputTableMobileGroup loans={this.state.loans} editing={this.state.editing} scenario={this.state.scenario} startEditing={this.startMobileEditing}/>
              Severity: Major
              Found in src/static/js/modules/loan-comparison/components/app.js and 1 other location - About 1 hr to fix
              src/static/js/modules/loan-comparison/components/app.js on lines 119..119

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

              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

                                          <LoanInputTable loans={this.state.loans} scenario={this.state.scenario} editing={this.state.editing} stopEditing={this.stopMobileEditing}/>
              Severity: Major
              Found in src/static/js/modules/loan-comparison/components/app.js and 1 other location - About 1 hr to fix
              src/static/js/modules/loan-comparison/components/app.js on lines 117..117

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

              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 EventObserver has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function EventObserver() {
              
                // The events registered on this instance.
                var _events = {};
              
              
              Severity: Minor
              Found in src/static/js/modules/prepare-worksheets/util/event-observer.js - About 1 hr to fix

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

                  flags: function() {
                    return [
                      {
                        text:        'There is a chance I might move within the next few years',
                        grade:       null,
                Severity: Minor
                Found in src/static/js/modules/prepare-worksheets/worksheet-config.js - About 1 hr to fix

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

                      render: function () {
                          return (
                              <div className="next-steps-container">
                                  <div className="content-l content-l__main">
                                      <div className="content-l_col content-l_col-1">
                  Severity: Minor
                  Found in src/static/js/modules/loan-comparison/components/next-steps.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language