Showing 290 of 290 total issues
Consider simplifying this complex logical expression. Open
if ( !options || !options.nav ) if (
/* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
/* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
/* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
) {
Consider simplifying this complex logical expression. Open
if ( !options || !options.nav ) if (
/* 1 */ ( !isFlippedBase && calendar.disabled( dateObject ) ) ||
/* 2 */ ( isFlippedBase && calendar.disabled( dateObject ) && ( hasEnabledWeekdays || hasEnabledBeforeTarget || hasEnabledAfterTarget ) ) ||
/* 3 */ ( !isFlippedBase && (dateObject.pick <= minLimitObject.pick || dateObject.pick >= maxLimitObject.pick) )
) {
Function validate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
DatePicker.prototype.validate = function( type, dateObject, options ) {
var calendar = this,
// Keep a reference to the original date.
Function validate
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
DatePicker.prototype.validate = function( type, dateObject, options ) {
var calendar = this,
// Keep a reference to the original date.
Function item
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
item: function( rowCounter ) {
// If Monday is the first day and the month starts on Sunday, shift the date back a week.
var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
Function item
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
item: function( rowCounter ) {
// If Monday is the first day and the month starts on Sunday, shift the date back a week.
var shiftDateBy = settings.firstDay && calendar.create([ viewsetObject.year, viewsetObject.month, 1 ]).day === 0 ? -7 : 0
Function placeDropdown
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function placeDropdown() {
// Check html data attributes
updateOptions();
// Set Dropdown state
Function placeDropdown
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function placeDropdown() {
// Check html data attributes
updateOptions();
// Set Dropdown state
Similar blocks of code found in 2 locations. Consider refactoring. Open
def test_get(self):
response = self.client.get(reverse('register_user'))
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, template_name='register.html')
- 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 48.
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
def test_get(self):
response = self.client.get(reverse('login'))
self.assertEquals(response.status_code, 200)
self.assertTemplateUsed(response, template_name='login.html')
- 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 48.
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 open
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
open: function( dontGiveFocus ) {
// If it’s already open, do nothing.
if ( STATE.open ) return P
Function open
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
open: function( dontGiveFocus ) {
// If it’s already open, do nothing.
if ( STATE.open ) return P
Function defaults
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
DatePicker.defaults = (function( prefix ) {
return {
// The title label to use for the month nav buttons
Function defaults
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
DatePicker.defaults = (function( prefix ) {
return {
// The title label to use for the month nav buttons
Function parallax
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.parallax = function () {
var window_width = $(window).width();
// Parallax Scripts
return this.each(function(i) {
var $this = $(this);
Function closeModal
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
closeModal: function(options) {
var defaults = {
out_duration: 250,
complete: undefined
},
Function parallax
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.parallax = function () {
var window_width = $(window).width();
// Parallax Scripts
return this.each(function(i) {
var $this = $(this);
Function closeModal
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
closeModal: function(options) {
var defaults = {
out_duration: 250,
complete: undefined
},
Function hide
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
hide: function(e) {
TouchHandler.touchup(e);
var el = this;
var width = el.clientWidth * 1.4;
Function hide
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
hide: function(e) {
TouchHandler.touchup(e);
var el = this;
var width = el.clientWidth * 1.4;