cfpb/owning-a-home

View on GitHub

Showing 90 of 154 total issues

Function resizeImage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

formExplainer.resizeImage = function( els, $window, windowResize ) {

  var pageWidth = els.$page.width();
  var $image = els.$imageMapImage;
  var currentHeight = $image.height();
Severity: Minor
Found in src/static/js/modules/form-explainer.js - About 45 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 positionNotes has a Cognitive Complexity of 7 (exceeds 5 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 35 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 fitAndStickToWindow has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

formExplainer.fitAndStickToWindow = function( els, pageNum ) {
  // http://stackoverflow.com/questions/318630/get-real-image-width-and-height-with-javascript-in-safari-chrome
  $( '<img/>' )
    .load( function() {
      // store image width for use in calculations on window resize
Severity: Minor
Found in src/static/js/modules/form-explainer.js - About 35 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 _getStorageType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function _getStorageType( storage ) {
  // Use default setting if none is provided.
  if ( typeof storage !== 'object' ) {
    if ( typeof _storage === 'undefined' ) {
      try {
Severity: Minor
Found in src/static/js/modules/web-storage-proxy.js - About 35 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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    render: function () {
        var note,
            noteHtml,
            rowType,
            prop = this.props.prop,
Severity: Minor
Found in src/static/js/modules/loan-comparison/components/loan-input-table-row.js - About 25 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 getState has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

module.exports.getState = function( options, callback ) {

  if ( !window.navigator.geolocation ) {
    var closestState = { name: 'AL' };
    return closestState;
Severity: Minor
Found in src/static/js/modules/geolocation.js - About 25 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 processRatesData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  processRatesData: function( data ) {
    // data: [rate: frequency, rate: frequency,...]
    data = data || {};
    var rates = [];
    var totalRates = [];
Severity: Minor
Found in src/static/js/modules/loan-comparison/stores/loan-store.js - About 25 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 generateCells has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    generateCells: function (rowType, outputRow) {
        var loans = this.props.loans;
        var cells = [];
        
        for (var i=0; i< loans.length; i++) {
Severity: Minor
Found in src/static/js/modules/loan-comparison/components/loan-input-table-row.js - About 25 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 generateClassName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    generateClassName: function (rowType, outputRow) {
        // shows 'linked' or 'independent' state of row's prop in UI
        var className = rowType + ' ' +  this.props.prop + '-row';
        
        // adds extra top padding to labels on rows with inputs
Severity: Minor
Found in src/static/js/modules/loan-comparison/components/loan-input-table-row.js - About 25 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 DataDocument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function DataDocument( inputs ) {
  var _inputs = inputs;

  /**
   * @returns {Array} Array of recorded inputs.
Severity: Minor
Found in src/static/js/modules/prepare-worksheets/util/data-document.js - About 25 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

Severity
Category
Status
Source
Language