Floppy/carbon-diet

View on GitHub

Showing 215 of 292 total issues

Function request has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  request: function(url) {
    this.url = url;
    this.method = this.options.method;
    var params = Object.isString(this.options.parameters) ?
          this.options.parameters :
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 finishDrag has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  finishDrag: function(event, success) {
    this.dragging = false;

    if(this.options.quiet){
      Position.prepare();
Severity: Minor
Found in app/assets/javascripts/standard/dragdrop.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 onEmptyHover has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  onEmptyHover: function(element, dropon, overlap) {
    var oldParentNode = element.parentNode;
    var droponOptions = Sortable.options(dropon);

    if(!Element.isParent(dropon, element)) {
Severity: Minor
Found in app/assets/javascripts/standard/dragdrop.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 amline has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def amline(period)
    # Generate graph
    emissions = @user.all_emissions
    case period
    when 0..90
Severity: Major
Found in app/controllers/reports_controller.rb - About 2 hrs to fix

    Function updateDrag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      updateDrag: function(event, pointer) {
        if(!this.dragging) this.startDrag(event);
    
        if(!this.options.quiet){
          Position.prepare();
    Severity: Minor
    Found in app/assets/javascripts/standard/dragdrop.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 insert has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      insert: function(element, insertions) {
        element = $(element);
    
        if (Object.isString(insertions) || Object.isNumber(insertions) ||
            Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
    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

    Method post has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def post
        # Create comment
        comment = Comment.new
        comment.commentable_type =  params[:comment][:commentable_type]
        case comment.commentable_type
    Severity: Minor
    Found in app/controllers/comments_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 initialize has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initialize: function(element) {
        var defaults = {
          handle: false,
          reverteffect: function(element, top_offset, left_offset) {
            var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
    Severity: Minor
    Found in app/assets/javascripts/standard/dragdrop.js - About 2 hrs to fix

      Function Str has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function Str(key, holder, stack) {
          var value = holder[key],
              type = typeof value;
      
          if (Type(value) === OBJECT_TYPE && typeof value.toJSON === 'function') {
      Severity: Minor
      Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

        Function Shrink has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function dealWithDeprecatedOptions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
            if (!options) return;
            function fallback(name, expr) {
              if (name in options || expr === undefined) return;
              options[name] = expr;
          Severity: Minor
          Found in app/assets/javascripts/standard/controls.js - About 1 hr 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 getStyle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              function(proceed, element, style) {
                switch (style) {
                  case 'left': case 'top': case 'right': case 'bottom':
                    if (proceed(element, 'position') === 'static') return null;
                  case 'height': case 'width':
          Severity: Minor
          Found in app/assets/javascripts/standard/prototype.js - About 1 hr 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 setOpacity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            Element.Methods.setOpacity = function(element, value) {
              element = $(element);
              element.style.opacity = (value == 1 || value === '') ? '' :
                (value < 0.00001) ? 0 : value;
          
          
          Severity: Minor
          Found in app/assets/javascripts/standard/prototype.js - About 1 hr 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 draw has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            draw: function(point) {
              var pos = this.element.cumulativeOffset();
              if(this.options.ghosting) {
                var r   = Position.realOffset(this.element);
                pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
          Severity: Minor
          Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr 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 onHover has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

            onHover: function(element, dropon, overlap) {
              if(Element.isParent(dropon, element)) return;
          
              if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
                return;
          Severity: Minor
          Found in app/assets/javascripts/standard/dragdrop.js - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              if not @current_user.nil? and (params[:login] == @current_user.login or params[:login].nil?)
                @profile = @current_user
              else
                @profile = User.find_by_login_and_public(params[:login], true)
          Severity: Minor
          Found in app/controllers/profile_controller.rb - About 1 hr 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 encodeForm has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function encodeForm(form)
          {
              function encode(inputs)
              {
                  for (var i = 0; i < inputs.length; ++i)
          Severity: Minor
          Found in public/iui/iui.js - About 1 hr to fix

            Function _createResponder has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function _createResponder(element, eventName, handler) {
                var registry = Element.retrieve(element, 'prototype_event_registry');
            
                if (Object.isUndefined(registry)) {
                  CACHE.push(element);
            Severity: Minor
            Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

              Function getPixelValue has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function getPixelValue(value, property, context) {
                  var element = null;
                  if (Object.isElement(value)) {
                    element = value;
                    value = element.getStyle(property);
              Severity: Minor
              Found in app/assets/javascripts/standard/prototype.js - About 1 hr to fix

                Method show has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  def show
                    respond_to do |format|
                      format.html {
                        @comments = @group.comments
                        # Generate league table
                Severity: Minor
                Found in app/controllers/groups_controller.rb - About 1 hr 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