nacl30d/akio

View on GitHub

Showing 171 of 171 total issues

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 js/materialize.js - About 2 hrs to fix

    Function toolbarToFAB has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var toolbarToFAB = function(btn) {
        if (btn.attr('data-open') !== "true") {
          return;
        }
    
    
    Severity: Major
    Found in js/materialize.js - About 2 hrs to fix

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

                      var isTouch = /^touch/.test(e.type),
                              x = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0,
                              y = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0;
      Severity: Major
      Found in js/materialize.js and 1 other location - About 2 hrs to fix
      js/materialize.js on lines 7841..7843

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

      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

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

                      var isTouch = /^touch/.test(e.type),
                              x = (isTouch ? e.originalEvent.changedTouches[0] : e).pageX - x0,
                              y = (isTouch ? e.originalEvent.changedTouches[0] : e).pageY - y0;
      Severity: Major
      Found in js/materialize.js and 1 other location - About 2 hrs to fix
      js/materialize.js on lines 7826..7828

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

      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

      Function returnToOriginal has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function returnToOriginal() {
      
              doneAnimating = false;
      
              var placeholder = origin.parent('.material-placeholder');
      Severity: Major
      Found in js/materialize.js - About 2 hrs to fix

        Function createToast has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function createToast(html) {
        
            // Create toast
            var toast = document.createElement('div');
            toast.classList.add('toast');
        Severity: Major
        Found in js/materialize.js - About 2 hrs to fix

          Function toast has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          ;Materialize.toast = function (message, displayLength, className, completeCallback) {
            className = className || "";
          
            var container = document.getElementById('toast-container');
          
          
          Severity: Minor
          Found in js/materialize.js - About 2 hrs to fix

          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 openModal has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  var openModal = function($trigger) {
                    var $body = $('body');
                    var oldWidth = $body.innerWidth();
                    $body.css('overflow', 'hidden');
                    $body.width(oldWidth);
          Severity: Major
          Found in js/materialize.js - About 2 hrs to fix

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

              $.fn.pushpin = function (options) {
                // Defaults
                var defaults = {
                  top: 0,
                  bottom: Infinity,
            Severity: Major
            Found in js/materialize.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 js/materialize.js - About 2 hrs to fix

                Function onKeyDown has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                          onKeyDown = function(e){
                            // TAB - switch to another input
                            if(e.which == 9){
                              $newSelect.trigger('close');
                              return;
                Severity: Minor
                Found in js/materialize.js - About 2 hrs to fix

                  Function prepareElementRoot has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function prepareElementRoot() {
                  
                          P.$root.
                  
                              on({
                  Severity: Minor
                  Found in js/materialize.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 js/materialize.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 js/materialize.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 js/materialize.js - About 1 hr to fix

                          Function mousedown has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function mousedown(e, space) {
                                      var offset = plate.offset(),
                                              isTouch = /^touch/.test(e.type),
                                              x0 = offset.left + dialRadius,
                                              y0 = offset.top + dialRadius,
                          Severity: Minor
                          Found in js/materialize.js - About 1 hr to fix

                            Function layerBoard has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              $.fn.layerBoard = function(option) {
                                  
                                    var elements = this;
                                    
                                    elements.each(function(){
                            Severity: Minor
                            Found in js/jquery.layerBoard.js - About 1 hr to fix

                              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
                              
                              
                              Severity: Minor
                              Found in js/materialize.js - About 1 hr to fix

                                Function removeMenu has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        var removeMenu = function(restoreNav) {
                                          panning = false;
                                          menuOut = false;
                                          // Reenable scrolling
                                          $('body').css({
                                Severity: Minor
                                Found in js/materialize.js - About 1 hr to fix

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

                                          $('<button type="button" class="btn-flat picker__close" tabindex="' + (options.twelvehour? '3' : '1') + '">' + options.donetext + '</button>').click($.proxy(this.done, this)).appendTo(this.footer);
                                  Severity: Major
                                  Found in js/materialize.js and 1 other location - About 1 hr to fix
                                  js/materialize.js on lines 7735..7735

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

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language