MiraitSystems/enju_trunk

View on GitHub
app/assets/javascripts/jquery.minicolors.js

Summary

Maintainability
F
4 days
Test Coverage

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

/*
 * jQuery MiniColors: A tiny color picker built on jQuery
 *
 * Copyright: Cory LaViska for A Beautiful Site, LLC.
 *
Severity: Major
Found in app/assets/javascripts/jquery.minicolors.js - About 1 day to fix

    Function updateFromControl has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function updateFromControl(input, target) {
    
            function getCoords(picker, container) {
    
                var left, top;
    Severity: Major
    Found in app/assets/javascripts/jquery.minicolors.js - About 3 hrs to fix

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

          function updateFromInput(input, preserveInputValue) {
      
              var hex,
                  hsb,
                  opacity,
      Severity: Major
      Found in app/assets/javascripts/jquery.minicolors.js - About 3 hrs to fix

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

                minicolors: function(method, data) {
        
                    switch(method) {
        
                        // Destroy the control
        Severity: Major
        Found in app/assets/javascripts/jquery.minicolors.js - About 2 hrs to fix

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

              function move(target, event, animate) {
          
                  var input = target.parents('.minicolors').find('.minicolors-input'),
                      settings = input.data('minicolors-settings'),
                      picker = target.find('[class$=-picker]'),
          Severity: Minor
          Found in app/assets/javascripts/jquery.minicolors.js - About 1 hr to fix

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

                function init(input, settings) {
            
                    var minicolors = $('<div class="minicolors" />'),
                        defaults = $.minicolors.defaults;
            
            
            Severity: Minor
            Found in app/assets/javascripts/jquery.minicolors.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                                      return $(this).data('minicolors-settings');
              Severity: Major
              Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return $(this);
                Severity: Major
                Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return $(this);
                  Severity: Major
                  Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return $(this);
                    Severity: Major
                    Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                              return $(this).val();
                      Severity: Major
                      Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                            return $(this);
                        Severity: Major
                        Found in app/assets/javascripts/jquery.minicolors.js - About 30 mins to fix

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

                                          y = keepWithin(grid.height() - Math.ceil(hsb.s / (100 / grid.height())), 0, grid.height());
                          Severity: Major
                          Found in app/assets/javascripts/jquery.minicolors.js and 2 other locations - About 1 hr to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 535..535
                          app/assets/javascripts/jquery.minicolors.js on lines 571..571

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

                          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 3 locations. Consider refactoring.
                          Open

                                          y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
                          Severity: Major
                          Found in app/assets/javascripts/jquery.minicolors.js and 2 other locations - About 1 hr to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 553..553
                          app/assets/javascripts/jquery.minicolors.js on lines 571..571

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

                          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 3 locations. Consider refactoring.
                          Open

                                          y = keepWithin(grid.height() - Math.ceil(hsb.b / (100 / grid.height())), 0, grid.height());
                          Severity: Major
                          Found in app/assets/javascripts/jquery.minicolors.js and 2 other locations - About 1 hr to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 535..535
                          app/assets/javascripts/jquery.minicolors.js on lines 553..553

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

                          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

                                          y = keepWithin(slider.height() - (hsb.b * (slider.height() / 100)), 0, slider.height());
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.minicolors.js and 1 other location - About 50 mins to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 542..542

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

                          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

                                          y = keepWithin(slider.height() - (hsb.s * (slider.height() / 100)), 0, slider.height());
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.minicolors.js and 1 other location - About 50 mins to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 560..560

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

                          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

                                  var hex = parseHex($(input).val(), true),
                                      rgb = hex2rgb(hex),
                                      opacity = $(input).attr('data-opacity');
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.minicolors.js and 1 other location - About 40 mins to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 639..641

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

                          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

                                  var hex = parseHex($(input).val(), true),
                                      rgb = hex2rgb(hex),
                                      opacity = $(input).attr('data-opacity');
                          Severity: Minor
                          Found in app/assets/javascripts/jquery.minicolors.js and 1 other location - About 40 mins to fix
                          app/assets/javascripts/jquery.minicolors.js on lines 629..631

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

                          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