cfpb/owning-a-home

View on GitHub

Showing 90 of 154 total issues

File common.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

var common = {};

common.loanCount = 2;
Severity: Minor
Found in src/static/js/modules/loan-comparison/common.js - About 2 hrs to fix

    Function polyfillElement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function polyfillElement(elem) {
        // If the element is already polyfilled, skip it
        if (elem.__placeholder != null) {
          // Make sure that if the placeholder is already shown, that it is at least up-to-date
          if (elem.__placeholder) {
    Severity: Major
    Found in src/static/js/modules/placeholder-polyfill.js - About 2 hrs to fix

      Function utils has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      var utils = function( id ) {
      
        var $el;
      
        if ( !id ) {
      Severity: Minor
      Found in src/static/js/modules/dropdown-utils.js - About 2 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

      Function processCounty has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function processCounty() {
        var $counties = $( '#county' );
        var $county = $( '#county' ).find( ':selected' );
        var $loan = dropdown( 'loan-type' );
        var norms = [ 'conf', 'fha', 'va' ];
      Severity: Major
      Found in src/static/js/modules/explore-rates.js - About 2 hrs to fix

        Function Notification has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function Notification( element ) { // eslint-disable-line max-statements, inline-comments, max-len
        
          var BASE_CLASS = 'm-notification';
        
          // Constants for the state of this Notification.
        Severity: Minor
        Found in src/static/js/modules/notification.js - About 2 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

        Function InputGraded has 58 lines of code (exceeds 25 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: Major
        Found in src/static/js/modules/prepare-worksheets/inputs/input-graded.js - About 2 hrs to fix

          File worksheet-config.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          'use strict';
          
          var gradedInput = require( './inputs/input-graded' );
          var notesInput = require( './inputs/input-notes' );
          var editorTemplate =
          Severity: Minor
          Found in src/static/js/modules/prepare-worksheets/worksheet-config.js - About 2 hrs to fix

            Function indexOf has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

              Array.prototype.indexOf = function(searchElement, fromIndex) {
            
                var k;
            
                // 1. Let O be the result of calling ToObject passing
            Severity: Minor
            Found in src/static/js/legacy/lte-ie8.js - About 2 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

            Function processCounty has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

            function processCounty() {
              var $counties = $( '#county' );
              var $county = $( '#county' ).find( ':selected' );
              var $loan = dropdown( 'loan-type' );
              var norms = [ 'conf', 'fha', 'va' ];
            Severity: Minor
            Found in src/static/js/modules/explore-rates.js - About 2 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

            Function render has 52 lines of code (exceeds 25 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) {

              Function checkForJumbo has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function checkForJumbo() {
                var loan;
                var jumbos = ['jumbo', 'agency', 'fha-hb', 'va-hb'];
                var norms = [ 'conf', 'fha', 'va' ];
                var warnings = {
              Severity: Major
              Found in src/static/js/modules/explore-rates.js - About 2 hrs to fix

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

                  function positionNotes( animating, expandable ) {
                    var $notes = $( '.educational-note div' );
                  
                    // Check that we're on desktop
                    if ( $notes.css( 'position' ) === 'absolute' ) {
                  Severity: Minor
                  Found in src/static/js/modules/loan-comparison/position-notes.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

                        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

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