Floppy/carbon-diet

View on GitHub

Showing 215 of 292 total issues

Function addMethods has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Element.addMethods = function(methods) {
  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;

  if (!methods) {
    Object.extend(Form, Form.Methods);
Severity: Major
Found in app/assets/javascripts/standard/prototype.js - About 3 hrs to fix

    Function _attributeTranslations has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      Element._attributeTranslations = (function(){
    
        var classProp = 'className',
            forProp = 'for',
            el = document.createElement('div');
    Severity: Major
    Found in app/assets/javascripts/standard/prototype.js - About 3 hrs to fix

      Function update has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        update: (function(){
      
          var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
            var el = document.createElement("select"),
                isBuggy = true;
      Severity: Major
      Found in app/assets/javascripts/standard/prototype.js - About 2 hrs to fix

        Function Enumerable has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        var Enumerable = (function() {
          function each(iterator, context) {
            var index = 0;
            try {
              this._each(function(value) {
        Severity: Minor
        Found in app/assets/javascripts/standard/prototype.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 extend has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        Element.extend = (function() {
        
          function checkDeficiency(tagName) {
            if (typeof window.Element != 'undefined') {
              var proto = window.Element.prototype;
        Severity: Minor
        Found in app/assets/javascripts/standard/prototype.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 _attributeTranslations has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

          Element._attributeTranslations = (function(){
        
            var classProp = 'className',
                forProp = 'for',
                el = document.createElement('div');
        Severity: Minor
        Found in app/assets/javascripts/standard/prototype.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 Grow has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Effect.Grow = function(element) {
          element = $(element);
          var options = Object.extend({
            direction: 'center',
            moveTransition: Effect.Transitions.sinoidal,
        Severity: Major
        Found in app/assets/javascripts/standard/effects.js - About 2 hrs to fix

          InPlaceEditor has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          Ajax.InPlaceEditor = Class.create({
            initialize: function(element, url, options) {
              this.url = url;
              this.element = element = $(element);
              this.prepareOptions();
          Severity: Minor
          Found in app/assets/javascripts/standard/controls.js - About 2 hrs to fix

            Method news_feed has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

              def news_feed(user, limit=10)
                feed = []
                # Get electricity reading data
                user.electricity_readings.limit(limit).order("taken_on DESC").where(:automatic => false).each do |reading|
                  feed << {:image => 'electricity.png', 
            Severity: Minor
            Found in app/helpers/profile_helper.rb - 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

            Method news_feed has 63 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def news_feed(user, limit=10)
                feed = []
                # Get electricity reading data
                user.electricity_readings.limit(limit).order("taken_on DESC").where(:automatic => false).each do |reading|
                  feed << {:image => 'electricity.png', 
            Severity: Major
            Found in app/helpers/profile_helper.rb - About 2 hrs to fix

              Base has 23 functions (exceeds 20 allowed). Consider refactoring.
              Open

              Autocompleter.Base = Class.create({
                baseInitialize: function(element, update, options) {
                  element          = $(element);
                  this.element     = element;
                  this.update      = $(update);
              Severity: Minor
              Found in app/assets/javascripts/standard/controls.js - About 2 hrs to fix

                Function parseColor has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                String.prototype.parseColor = function() {
                  var color = '#';
                  if (this.slice(0,4) == 'rgb(') {
                    var cols = this.slice(4,this.length-1).split(',');
                    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
                Severity: Minor
                Found in app/assets/javascripts/standard/effects.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 setDimensions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  setDimensions: function(height, width) {
                    var d = { };
                    if (this.options.scaleX) d.width = width.round() + 'px';
                    if (this.options.scaleY) d.height = height.round() + 'px';
                    if (this.options.scaleFromCenter) {
                Severity: Minor
                Found in app/assets/javascripts/standard/effects.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 setup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  setup: function(){
                    function parseColor(color){
                      if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
                      color = color.parseColor();
                      return $R(0,2).map(function(i){
                Severity: Minor
                Found in app/assets/javascripts/standard/effects.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

                Method index has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    respond_to do |format|
                      format.html {
                        # Generate league table
                        @leaguetable = []
                Severity: Minor
                Found in app/controllers/friends_controller.rb - 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

                Method signup has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def signup
                    # Confirm password
                    if session[:password] != params[:user][:password_confirmation]
                      flash[:notice] = "Passwords did not match, please check and try again"
                    # Everything checks out...
                Severity: Minor
                Found in app/controllers/user_controller.rb - 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

                Method amline has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def amline(period)
                    # Generate graph
                    emissions = @user.all_emissions
                    case period
                    when 0..90
                Severity: Minor
                Found in app/controllers/reports_controller.rb - 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 Class has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var Class = (function() {
                
                  var IS_DONTENUM_BUGGY = (function(){
                    for (var p in { toString: 1 }) {
                      if (p === 'toString') return false;
                Severity: Major
                Found in app/assets/javascripts/standard/prototype.js - About 2 hrs to fix

                  Function extend has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  Element.extend = (function() {
                  
                    function checkDeficiency(tagName) {
                      if (typeof window.Element != 'undefined') {
                        var proto = window.Element.prototype;
                  Severity: Major
                  Found in app/assets/javascripts/standard/prototype.js - About 2 hrs to fix

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

                    Sizzle.filter = function(expr, set, inplace, not){
                        var old = expr, result = [], curLoop = set, match, anyFound,
                            isXMLFilter = set && set[0] && isXML(set[0]);
                    
                        while ( expr && set.length ) {
                    Severity: Major
                    Found in app/assets/javascripts/standard/prototype.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language