cfpb/owning-a-home

View on GitHub

Showing 90 of 154 total issues

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

    render: function() {
        var worksheet = this.state.worksheet || {};
        return (
          <div className="monthly-payment_worksheet">
            <section>
Severity: Major
Found in src/static/js/modules/monthly-payment-worksheet.js - About 2 days to fix

    File explore-rates.js has 851 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    var $ = require( 'jquery' );
    var jQuery = $;
    require( 'highcharts' );
    Severity: Major
    Found in src/static/js/modules/explore-rates.js - About 2 days to fix

      Function exports has 388 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function( grunt ) {
      
        'use strict';
      
        var path = require( 'path' );
      Severity: Major
      Found in Gruntfile.js - About 1 day to fix

        Function createNewForm has 336 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createNewForm( id, loanData ) {
        
          var loan = objectify( '#lc-input-' + id, [
            {
              name:   'amount-borrowed',
        Severity: Major
        Found in src/static/js/modules/formalize.js - About 1 day to fix

          File monthly-payment-worksheet.js has 550 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          var React = require( 'react' );
          var $ = jQuery = require( 'jquery' );
          require( 'jquery.scrollto' );
          
          var InputUSD = require( './react-components/input-usd.jsx' );
          Severity: Major
          Found in src/static/js/modules/monthly-payment-worksheet.js - About 1 day to fix

            Function process_journey has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

            def process_journey(item):
            
                del item['comments']
                del item['date']
                custom_fields = item['custom_fields']
            Severity: Minor
            Found in src/_lib/wordpress_journey_processor.py - About 1 day 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 Notifier has 158 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var Notifier = function(watching){
                var _listeners = [], _acceptLists = [], _updates = [], _updater = false, properties = [], values = [];
                  var self = this;
                  Object.defineProperty(self, '_watching', {
                              enumerable: true,
            Severity: Major
            Found in src/static/js/modules/object.observe-polyfill.js - About 6 hrs to fix

              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

                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

                              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

                                Function updateView has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function updateView() {
                                  chart.startLoading();
                                
                                  // reset view
                                  dropdown( [ 'county', 'loan-term' ] ).hideHighlight();
                                Severity: Major
                                Found in src/static/js/modules/explore-rates.js - About 3 hrs to fix

                                  Function Notification has 75 lines of code (exceeds 25 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: Major
                                  Found in src/static/js/modules/notification.js - About 3 hrs to fix

                                    Function Worksheet has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function Worksheet( options ) {
                                      var _inputsList = {};
                                      var _inputsGroupDOM;
                                    
                                      var _container = options.container;
                                    Severity: Major
                                    Found in src/static/js/modules/prepare-worksheets/worksheet-controller.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language