cfpb/owning-a-home

View on GitHub

Showing 90 of 154 total issues

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

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

        Function getRateData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function getRateData() {
            if ( currentRequest && typeof currentRequest === 'object' ) {
              currentRequest.abort();
            }
        
        
        Severity: Minor
        Found in src/static/js/modules/formalize.js - About 1 hr to fix

          Function renderInterestAmounts has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function renderInterestAmounts() {
            var shortTermVal = [],
                longTermVal = [],
                rate,
                fullTerm = +( getSelection( 'loan-term' ) ) * 12;
          Severity: Minor
          Found in src/static/js/modules/explore-rates.js - About 1 hr to fix

            Function InputGraded has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function InputGraded( options ) {
              // TODO see if bind() can be used in place of _self = this.
              // Note bind()'s lack of IE8 support.
              var _self = this;
              // Load our handlebar templates.
            Severity: Minor
            Found in src/static/js/modules/prepare-worksheets/inputs/input-graded.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 a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

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

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

                componentDidMount: function() {
                    var scenario = this.state.scenario;
                    var animating;
            
                    LoanStore.addChangeListener(this._onChange);
            Severity: Minor
            Found in src/static/js/modules/loan-comparison/components/app.js - About 1 hr to fix

              Function dispatchToken has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              LoanStore.dispatchToken = AppDispatcher.register( function( action ) {
                switch( action.actionType ) {
              
                  case LoanConstants.UPDATE_LOAN:
                    // update both loans or single loan, dep. on whether the prop changed
              Severity: Minor
              Found in src/static/js/modules/loan-comparison/stores/loan-store.js - About 1 hr to fix

                Function Observer has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var Observer = (function(){
                      var wraped = [];
                      var Observer = function(O, callback, accept){
                        validateArguments(O, callback, accept);
                        if (!accept) {
                Severity: Minor
                Found in src/static/js/modules/object.observe-polyfill.js - About 1 hr to fix

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

                      render: function() {
                          var loading = "";
                          var results = ['closing-costs','monthly-payment','overall-costs'].map(function (prop) {
                              return (
                                  <LoanOutputTable result={prop} prop={prop} loans={this.props.loans}  scenario={this.props.scenario} />

                    Function checkARM has 29 lines of code (exceeds 25 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 1 hr to fix

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

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

                      LoanStore.dispatchToken = AppDispatcher.register( function( action ) {
                        switch( action.actionType ) {
                      
                          case LoanConstants.UPDATE_LOAN:
                            // update both loans or single loan, dep. on whether the prop changed
                      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

                      Function filterEmptyRows has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      this.filterEmptyRows = function( worksheet, opts ) {
                        // Filters out worksheet rows without text values
                        // opts.requireGrade = true will also filter out items without grades
                        // opts.skipLast = true will allow blank values for last item
                        // TODO: add delete option?
                      Severity: Minor
                      Found in src/static/js/modules/prepare-worksheets/worksheet-model.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 InputNotes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function InputNotes( options ) {
                        // TODO see if bind() can be used in place of _self = this.
                        // Note bind()'s lack of IE8 support.
                        var _self = this;
                        var _row = options.row;
                      Severity: Minor
                      Found in src/static/js/modules/prepare-worksheets/inputs/input-notes.js - About 1 hr to fix

                        Function loadPage has 27 lines of code (exceeds 25 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 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 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
                              Severity
                              Category
                              Status
                              Source
                              Language