Pi2-FGABreja/FGABrejaWeb

View on GitHub
FGABreja/static/js/date_picker/picker.date.js

Summary

Maintainability
F
2 mos
Test Coverage

File picker.date.js has 852 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Date picker for pickadate.js v3.5.0
 * http://amsul.github.io/pickadate.js/date.htm
 */

Severity: Major
Found in FGABreja/static/js/date_picker/picker.date.js - About 2 days to fix

    Function nodes has 266 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    DatePicker.prototype.nodes = function( isOpen ) {
    
        var
            calendar = this,
            settings = calendar.settings,
    Severity: Major
    Found in FGABreja/static/js/date_picker/picker.date.js - About 1 day to fix

      Function DatePicker has 84 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function DatePicker( picker, settings ) {
      
          var calendar = this,
              element = picker.$node[ 0 ],
              elementValue = element.value,
      Severity: Major
      Found in FGABreja/static/js/date_picker/picker.date.js - About 3 hrs to fix

        Function activate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        DatePicker.prototype.activate = function( type, datesToEnable ) {
        
            var calendar = this,
                disabledItems = calendar.item.disable,
                disabledItemsCount = disabledItems.length
        Severity: Major
        Found in FGABreja/static/js/date_picker/picker.date.js - About 2 hrs to fix

          Function formats has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          DatePicker.prototype.formats = (function() {
          
              // Return the length of the first word in a collection.
              function getWordLengthFromCollection( string, collection, dateObject ) {
          
          
          Severity: Major
          Found in FGABreja/static/js/date_picker/picker.date.js - About 2 hrs to fix

            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) )
                ) {
            Severity: Critical
            Found in FGABreja/static/js/date_picker/picker.date.js - About 2 hrs to fix

              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.
              Severity: Minor
              Found in FGABreja/static/js/date_picker/picker.date.js - About 2 hrs to fix

                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
                
                
                Severity: Minor
                Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                  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
                  Severity: Minor
                  Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                    Function createYearLabel has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            createYearLabel = function(override) {
                    
                                var focusedYear = viewsetObject.year,
                    
                                // If years selector is set to a literal "true", set it to 5. Otherwise
                    Severity: Minor
                    Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                      Function createMonthLabel has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              createMonthLabel = function(override) {
                      
                                  var monthsCollection = settings.showMonthsShort ? settings.monthsShort : settings.monthsFull
                      
                                   // Materialize modified
                      Severity: Minor
                      Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                        Function item has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                                    item: function( targetDate ) {
                        
                                                        // Convert the time date from a relative date to a target date.
                                                        targetDate = calendar.create([ viewsetObject.year, viewsetObject.month, targetDate + ( settings.firstDay ? 1 : 0 ) ])
                        
                        
                        Severity: Minor
                        Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                          Function deactivate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          DatePicker.prototype.deactivate = function( type, datesToDisable ) {
                          
                              var calendar = this,
                                  disabledItems = calendar.item.disable.slice(0)
                          
                          
                          Severity: Minor
                          Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                            Function navigate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            DatePicker.prototype.navigate = function( type, value, options ) {
                            
                                var targetDateObject,
                                    targetYear,
                                    targetMonth,
                            Severity: Minor
                            Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                              Function set has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              DatePicker.prototype.set = function( type, value, options ) {
                              
                                  var calendar = this,
                                      calendarItem = calendar.item
                              
                              
                              Severity: Minor
                              Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                                Function create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                DatePicker.prototype.create = function( type, value, options ) {
                                
                                    var isInfiniteValue,
                                        calendar = this
                                
                                
                                Severity: Minor
                                Found in FGABreja/static/js/date_picker/picker.date.js - About 1 hr to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if ( !matchFound[3] ) matchFound.push( 'inverted' )
                                  Severity: Major
                                  Found in FGABreja/static/js/date_picker/picker.date.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        else if ( _.isDate( unitToEnable ) ) {
                                                            matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
                                                        }
                                    Severity: Major
                                    Found in FGABreja/static/js/date_picker/picker.date.js - About 45 mins to fix

                                      Consider simplifying this complex logical expression.
                                      Open

                                                      if (
                                                          _.isInteger( unitToDisable ) ||
                                                          _.isDate( unitToDisable ) ||
                                                          $.isArray( unitToDisable ) ||
                                                          ( $.isPlainObject( unitToDisable ) && unitToDisable.from && unitToDisable.to )
                                      Severity: Major
                                      Found in FGABreja/static/js/date_picker/picker.date.js - About 40 mins to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                                if ( isFlippedBase && !hasEnabledWeekdays && ( ( !hasEnabledAfterTarget && interval > 0 ) || ( !hasEnabledBeforeTarget && interval < 0 ) ) ) {
                                                    interval *= -1
                                                }
                                        Severity: Major
                                        Found in FGABreja/static/js/date_picker/picker.date.js - About 40 mins to fix

                                          Similar blocks of code found in 2 locations. Consider refactoring.
                                          Open

                                          (function ( factory ) {
                                          
                                              // AMD.
                                              if ( typeof define == 'function' && define.amd )
                                                  define( ['picker', 'jquery'], factory )
                                          Severity: Major
                                          Found in FGABreja/static/js/date_picker/picker.date.js and 1 other location - About 2 mos to fix
                                          FGABreja/static/js/bin/materialize.js on lines 4736..6158

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

                                          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

                                          Further Reading

                                          There are no issues that match your filters.

                                          Category
                                          Status