File explore-rates.js
has 851 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var $ = require( 'jquery' );
var jQuery = $;
require( 'highcharts' );
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();
Function updateView
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateView() {
chart.startLoading();
// reset view
dropdown( [ 'county', 'loan-term' ] ).hideHighlight();
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' ];
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' ];
- Read upRead up
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 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 = {
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();
- Read upRead up
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 renderInterestAmounts
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderInterestAmounts() {
var shortTermVal = [],
longTermVal = [],
rate,
fullTerm = +( getSelection( 'loan-term' ) ) * 12;
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' ];
Function loadCounties
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadCounties() {
// And request 'em.
var request = getCounties();
request.done( function( resp ) {
Function checkForJumbo
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function checkForJumbo() {
var loan;
var jumbos = ['jumbo', 'agency', 'fha-hb', 'va-hb'];
var norms = [ 'conf', 'fha', 'va' ];
var warnings = {
- Read upRead up
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 renderDownPayment
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function renderDownPayment() {
var $el = $( this );
var $price = $( '#house-price' );
var $percent = $( '#percent-down' );
- Read upRead up
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 checkARM
has a Cognitive Complexity of 8 (exceeds 5 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' ];
- Read upRead up
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
var template = {
county: county,
countyConfWarning: countyConfWarning,
countyFHAWarning: countyFHAWarning,
countyVAWarning: countyVAWarning,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 62.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( length < 180 ) {
shortTermVal.push( {
rate: parseFloat( rate ),
interest: parseFloat( totalInterest ),
term: length / 12
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
longTermVal.push( {
rate: parseFloat( rate ),
interest: parseFloat( totalInterest ),
term: length / 12
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 50.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( disallowedTerms.indexOf( params['loan-term'] ) !== -1 ) {
dropdown( 'loan-term' ).reset();
dropdown( 'loan-term' ).showHighlight();
$( '#arm-warning' ).removeClass( 'hidden' );
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 47.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( disallowedTypes.indexOf( params['loan-type'] ) !== -1 ) {
dropdown( 'loan-type' ).reset();
dropdown( 'loan-type' ).showHighlight();
$( '#arm-warning' ).removeClass( 'hidden' );
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 47.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76