mambax7/extgallery

View on GitHub
assets/js/microgallery/jquery.microgallery.js

Summary

Maintainability
F
5 days
Test Coverage

Function microgallery has 91 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.fn.microgallery = function(options) {
        var opts = $.extend({}, $.fn.microgallery.defaults, options);
        return this.each(function() {
            var $this = $(this);
            var o = $.meta ? $.extend({}, opts, $this.data()) : opts;
Severity: Major
Found in assets/js/microgallery/jquery.microgallery.js - About 3 hrs to fix

    Function resize has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        $.fn.resize = function($img,mode,o){
            var maxW = 0;
            var maxH = 0;
            if(mode == 'single'){
                switch(o.size){
    Severity: Major
    Found in assets/js/microgallery/jquery.microgallery.js - About 3 hrs to fix

      File jquery.microgallery.js has 280 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function($) {
          $.fn.microgallery = function(options) {
              var opts = $.extend({}, $.fn.microgallery.defaults, options);
              return this.each(function() {
                  var $this = $(this);
      Severity: Minor
      Found in assets/js/microgallery/jquery.microgallery.js - About 2 hrs to fix

        Function build has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.build = function($this,o,mode,current,incfactor){
                    $this.find('img').wrap('<div style="display:none"/>').show();
                    switch(o.size){
                        case 'small'    :
                            $this.addClass('smallGallery');
        Severity: Minor
        Found in assets/js/microgallery/jquery.microgallery.js - About 1 hr to fix

          Function toggleMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              $.fn.toggleMode = function($mg,mode,current,o,incfactor){
          Severity: Minor
          Found in assets/js/microgallery/jquery.microgallery.js - About 35 mins to fix

            Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                $.fn.build = function($this,o,mode,current,incfactor){
            Severity: Minor
            Found in assets/js/microgallery/jquery.microgallery.js - About 35 mins to fix

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

                      else{
                          switch(o.size){
                              case 'small'    :
                                  maxW = $.fn.microgallery.sizes.smallW;
                                  maxH = $.fn.microgallery.sizes.smallH;
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 1 day to fix
              assets/js/microgallery/jquery.microgallery.js on lines 216..235

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

              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

                      if(mode == 'single'){
                          switch(o.size){
                              case 'small'    :
                                  maxW = $.fn.microgallery.sizes.smallThumbW;
                                  maxH = $.fn.microgallery.sizes.smallThumbH;
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 1 day to fix
              assets/js/microgallery/jquery.microgallery.js on lines 236..255

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

              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

                      else if(imgheight > maxH){
                          var newheight = maxH;
                          var ratio = maxH / imgheight;
                          var newwidth = imgwidth * ratio;
                          if(newwidth > maxW){
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 4 hrs to fix
              assets/js/microgallery/jquery.microgallery.js on lines 261..296

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

              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

                      if(imgwidth > maxW){
                          var newwidth = maxW;
                          var ratio = maxW / imgwidth;
                          var newheight = imgheight * ratio;
                          if(newheight > maxH){
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 4 hrs to fix
              assets/js/microgallery/jquery.microgallery.js on lines 277..296

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

              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

                                  if(mode == 'single'){
                                      $current    = $('.images div:nth-child('+current+')',$this);
                                      $next       = $current.next();
                                      if($next.length){
                                          $current.hide();
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 2 hrs to fix
              assets/js/microgallery/jquery.microgallery.js on lines 49..68

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

              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

                                  if(mode == 'single'){
                                      $current    = $('.images div:nth-child('+current+')',$this);
                                      $prev       = $current.prev();
                                      if($prev.length){
                                          $current.hide();
              Severity: Major
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 2 hrs to fix
              assets/js/microgallery/jquery.microgallery.js on lines 23..44

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

              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

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

                          $('img',$images).each(function(){
                              var $theImage = $(this);
                              $.fn.resize($theImage,mode,o);
                          });
              Severity: Minor
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 50 mins to fix
              assets/js/microgallery/jquery.microgallery.js on lines 179..182

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

              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

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

                          $('img',$images).each(function(){
                              var $theImage = $(this);
                              $.fn.resize($theImage,mode,o);
                          });
              Severity: Minor
              Found in assets/js/microgallery/jquery.microgallery.js and 1 other location - About 50 mins to fix
              assets/js/microgallery/jquery.microgallery.js on lines 190..193

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

              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