Floppy/carbon-diet

View on GitHub

Showing 215 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

              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

                    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

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

                      var Class = (function() {
                      
                        var IS_DONTENUM_BUGGY = (function(){
                          for (var p in { toString: 1 }) {
                            if (p === 'toString') return false;
                      Severity: Minor
                      Found in app/assets/javascripts/standard/prototype.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

                      Function Hash has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var Hash = Class.create(Enumerable, (function() {
                        function initialize(object) {
                          this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
                        }
                      
                      
                      Severity: Major
                      Found in app/assets/javascripts/standard/prototype.js - About 3 hrs to fix

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

                          create: function(element) {
                            element = $(element);
                            var options = Object.extend({
                              element:     element,
                              tag:         'li',       // assumes li children, override with tag: 'tagname'
                        Severity: Major
                        Found in app/assets/javascripts/standard/dragdrop.js - About 3 hrs to fix

                          Function getStyle has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                            Element.Methods.getStyle = function(element, style) {
                              element = $(element);
                              style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
                              var value = element.style[style];
                              if (!value && element.currentStyle) value = element.currentStyle[style];
                          Severity: Minor
                          Found in app/assets/javascripts/standard/prototype.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