Showing 154 of 154 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
return {
disable: disable,
enable: enable,
show: show,
hide: hide,
- 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
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
Function getRateData
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getRateData() {
if ( currentRequest && typeof currentRequest === 'object' ) {
currentRequest.abort();
}
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 render
has a Cognitive Complexity of 11 (exceeds 5 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) {
- 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 InputGraded
has a Cognitive Complexity of 11 (exceeds 5 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.
- 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 componentDidMount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidMount: function() {
var scenario = this.state.scenario;
var animating;
LoanStore.addChangeListener(this._onChange);
Function dispatchToken
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
LoanStore.dispatchToken = AppDispatcher.register( function( action ) {
switch( action.actionType ) {
case LoanConstants.UPDATE_LOAN:
// update both loans or single loan, dep. on whether the prop changed
Function Observer
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
var Observer = (function(){
var wraped = [];
var Observer = function(O, callback, accept){
validateArguments(O, callback, accept);
if (!accept) {
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
render: function() {
var loading = "";
var results = ['closing-costs','monthly-payment','overall-costs'].map(function (prop) {
return (
<LoanOutputTable result={prop} prop={prop} loans={this.props.loans} scenario={this.props.scenario} />
Similar blocks of code found in 2 locations. Consider refactoring. Open
fetchInsurance: function( loan ) {
return api.fetchMortgageInsuranceData( loan )
.done( function( results ) {
LoanStore.updateLoanInsurance( loan, ( results || {} ).data );
} );
- 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 59.
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
fetchRates: function( loan ) {
return api.fetchRateData( loan )
.done( function( results ) {
LoanStore.updateLoanRates( loan, ( results || {} ).data );
} );
- 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 59.
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
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 filterEmptyRows
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
this.filterEmptyRows = function( worksheet, opts ) {
// Filters out worksheet rows without text values
// opts.requireGrade = true will also filter out items without grades
// opts.skipLast = true will allow blank values for last item
// TODO: add delete option?
- 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 EmailSignup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function EmailSignup( element ) {
var UNDEFINED;
var _baseElement = $(element);
var _formElement = _baseElement.find( 'form' );
var _emailElement = _formElement.find( 'input[type="email"]' );
- 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 dispatchToken
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
LoanStore.dispatchToken = AppDispatcher.register( function( action ) {
switch( action.actionType ) {
case LoanConstants.UPDATE_LOAN:
// update both loans or single loan, dep. on whether the prop changed
- 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 loadPage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadPage( lastPage, pageNum ) {
formExplainer.currentPage = pageNum;
$( '.form-explainer_page-link' ).removeClass( 'current-page' );
$( '.form-explainer_page-link[data-page=' + pageNum + ']' ).addClass( 'current-page' );
Function InputNotes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function InputNotes( options ) {
// TODO see if bind() can be used in place of _self = this.
// Note bind()'s lack of IE8 support.
var _self = this;
var _row = options.row;
Similar blocks of code found in 2 locations. Consider refactoring. Open
function removeEvent(obj, event, func) {
if (obj.removeEventListener) {
obj.removeEventListener(event, func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on' + event, func);
- 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 56.
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
function addEvent(obj, event, func) {
if (obj.addEventListener) {
obj.addEventListener(event, func, false);
} else if (obj.attachEvent) {
obj.attachEvent('on' + event, func);
- 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 56.
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