cfpb/owning-a-home

View on GitHub
src/static/js/modules/loan-comparison/components/loan-input-table-row.js

Summary

Maintainability
A
1 hr
Test Coverage

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

There are no issues that match your filters.

Category
Status