Function datetimepickerDirective
has 297 lines of code (exceeds 25 allowed). Consider refactoring. Open
.directive('datetimepicker', ['$log', 'dateTimePickerConfig', function datetimepickerDirective($log, defaultConfig) {
function DateObject() {
var tempDate = new Date();
Function link
has 209 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function link(scope, element, attrs, ngModelController) {
var directiveConfig = {};
if (attrs.datetimepickerConfig) {
File datetimepicker.js
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*globals define, jQuery, module, require */
/*jslint vars:true */
/**
* @license angular-bootstrap-datetimepicker version: 0.3.12
Function day
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
day: function day(unixDate) {
var selectedDate = moment.utc(unixDate);
var startOfMonth = moment.utc(selectedDate).startOf('month');
var previousViewDate = moment.utc(selectedDate).startOf('year');
Function validateConfiguration
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var validateConfiguration = function validateConfiguration(configuration) {
var validOptions = ['startView', 'minView', 'minuteStep', 'dropdownSelector'];
for (var prop in configuration) {
//noinspection JSUnfilteredForInLoop
Function year
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
year: function year(unixDate) {
var selectedDate = moment.utc(unixDate).startOf('year');
// View starts one year before the decade starts and ends one year after the decade ends
// i.e. passing in a date of 1/1/2013 will give a range of 2009 to 2020
// Truncate the last digit from the current year and subtract 1 to get the start of the decade
Function minute
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
minute: function minute(unixDate) {
var selectedDate = moment.utc(unixDate).startOf('hour');
var previousViewDate = moment.utc(selectedDate).startOf('day');
var activeFormat = ngModelController.$modelValue ? moment(ngModelController.$modelValue).format('YYYY-MM-DD H:mm') : '';
Similar blocks of code found in 2 locations. Consider refactoring. Open
var result = {
'previousView': 'day',
'currentView': 'hour',
'nextView': configuration.minView === 'hour' ? 'setTime' : 'minute',
'previousViewDate': new DateObject({
- 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 156.
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 result = {
'previousView': 'year',
'currentView': 'month',
'nextView': configuration.minView === 'month' ? 'setTime' : 'day',
'previousViewDate': new DateObject({
- 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 156.
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
for (var i = 0; i < 12; i += 1) {
var monthMoment = moment.utc(startDate).add(i, 'months');
var dateValue = {
'utcDateValue': monthMoment.valueOf(),
'display': monthMoment.format('MMM'),
- 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 118.
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
for (var i = 0; i < 24; i += 1) {
var hourMoment = moment.utc(selectedDate).add(i, 'hours');
var dateValue = {
'utcDateValue': hourMoment.valueOf(),
'display': hourMoment.format('LT'),
- 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 118.
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