Floppy/carbon-diet

View on GitHub

Showing 292 of 292 total issues

File prototype.js has 4865 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*  Prototype JavaScript framework, version 1.7_rc3
 *  (c) 2005-2010 Sam Stephenson
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *  For details, see the Prototype web site: http://www.prototypejs.org/
Severity: Major
Found in app/assets/javascripts/standard/prototype.js - About 2 wks to fix

    File effects.js has 1014 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // script.aculo.us effects.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
    
    // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
    // Contributors:
    //  Justin Palmer (http://encytemedia.com/)
    Severity: Major
    Found in app/assets/javascripts/standard/effects.js - About 2 days to fix

      File controls.js has 804 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // script.aculo.us controls.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
      
      // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
      //           (c) 2005-2010 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
      //           (c) 2005-2010 Jon Tirsen (http://www.tirsen.com)
      Severity: Major
      Found in app/assets/javascripts/standard/controls.js - About 1 day to fix

        File dragdrop.js has 786 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // script.aculo.us dragdrop.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
        
        // Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
        //
        // script.aculo.us is freely distributable under the terms of an MIT-style license.
        Severity: Major
        Found in app/assets/javascripts/standard/dragdrop.js - About 1 day to fix

          File iui.js has 729 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
             copyright:
             Copyright (c) 2007-12, iUI Project Members.
             See LICENSE.txt for licensing terms.
             Version 0.4-beta3
          Severity: Major
          Found in public/iui/iui.js - About 1 day to fix

            Function Enumerable has 209 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Enumerable = (function() {
              function each(iterator, context) {
                var index = 0;
                try {
                  this._each(function(value) {
            Severity: Major
            Found in app/assets/javascripts/standard/prototype.js - About 1 day to fix

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

                    'width': function(element) {
                      if (!this._preComputing) this._begin();
              
                      var bWidth = this.get('border-box-width');
                      if (bWidth <= 0) {
              Severity: Major
              Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 7 hrs to fix
              app/assets/javascripts/standard/prototype.js on lines 3380..3398

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

              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

                    'height': function(element) {
                      if (!this._preComputing) this._begin();
              
                      var bHeight = this.get('border-box-height');
                      if (bHeight <= 0) {
              Severity: Major
              Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 7 hrs to fix
              app/assets/javascripts/standard/prototype.js on lines 3400..3418

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

              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

              Methods has 48 functions (exceeds 20 allowed). Consider refactoring.
              Open

              Element.Methods = {
                visible: function(element) {
                  return $(element).style.display != 'none';
                },
              
              
              Severity: Minor
              Found in app/assets/javascripts/standard/prototype.js - About 6 hrs to fix

                Class User has 45 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class User < ActiveRecord::Base
                  # Relationships
                  belongs_to :country
                  has_many :electricity_accounts do
                    def current
                Severity: Minor
                Found in app/models/user.rb - About 6 hrs to fix

                  File user.rb has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'digest/sha2'
                  require 'mini_magick'
                  
                  class User < ActiveRecord::Base
                    # Relationships
                  Severity: Minor
                  Found in app/models/user.rb - About 5 hrs to fix

                    Function addMethods has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Element.addMethods = function(methods) {
                      var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
                    
                      if (!methods) {
                        Object.extend(Form, Form.Methods);
                    Severity: Minor
                    Found in app/assets/javascripts/standard/prototype.js - About 4 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 update has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                      update: (function(){
                    
                        var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
                          var el = document.createElement("select"),
                              isBuggy = true;
                    Severity: Minor
                    Found in app/assets/javascripts/standard/prototype.js - About 4 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

                    Method auth has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def auth
                        # Find user and check password
                        result = User.authenticate(params[:user][:login], params[:user][:password])
                        if result == :no_such_user
                          if mobile?
                    Severity: Minor
                    Found in app/controllers/user_controller.rb - About 4 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

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

                        if (eventName.include(':')) {
                          if (element.addEventListener)
                            element.addEventListener("dataavailable", responder, false);
                          else {
                            element.attachEvent("ondataavailable", responder);
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 4 hrs to fix
                    app/assets/javascripts/standard/prototype.js on lines 5562..5575

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

                    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 (eventName.include(':')) {
                          if (element.removeEventListener)
                            element.removeEventListener("dataavailable", responder, false);
                          else {
                            element.detachEvent("ondataavailable", responder);
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 4 hrs to fix
                    app/assets/javascripts/standard/prototype.js on lines 5516..5530

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

                    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 setOptions has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                    Open

                      setOptions: function(options) {
                        this.options = Object.extend({
                          choices: 10,
                          partialSearch: true,
                          partialChars: 2,
                    Severity: Minor
                    Found in app/assets/javascripts/standard/controls.js - About 4 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

                    Method convolve has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def convolve(kernel)
                        # Check kernel size is odd
                        raise "kernel must be uneven width" unless kernel.size.odd?
                        # Get input data so we don't keep using the hash
                        input = self[:values]
                    Severity: Minor
                    Found in app/models/graph_data.rb - About 3 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 Sizzle has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var Sizzle = function(selector, context, results, seed) {
                        results = results || [];
                        var origContext = context = context || document;
                    
                        if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js - About 3 hrs to fix

                      Function start has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                      Open

                        start: function(options) {
                          if (options && options.transition === false) options.transition = Effect.Transitions.linear;
                          this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
                          this.currentFrame = 0;
                          this.state        = 'idle';
                      Severity: Minor
                      Found in app/assets/javascripts/standard/effects.js - About 3 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

                      Severity
                      Category
                      Status
                      Source
                      Language