felipero/couchrails

View on GitHub

Showing 149 of 206 total issues

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

  match: function(element) {
    this.tokens = [];

    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
    var le, p, m, len = ps.length, name;
Severity: Minor
Found in examples/helloworld/public/javascripts/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 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 examples/helloworld/public/javascripts/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 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 examples/helloworld/public/javascripts/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 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 examples/helloworld/public/javascripts/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 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 examples/helloworld/public/javascripts/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 _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 examples/helloworld/public/javascripts/prototype.js - About 1 hr to fix

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

      request: function(url) {
        this.url = url;
        this.method = this.options.method;
        var params = Object.clone(this.options.parameters);
    
    
    Severity: Minor
    Found in examples/helloworld/public/javascripts/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 setOptions has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      setOptions: function(options) {
        this.options = Object.extend({
          choices: 10,
          partialSearch: true,
          partialChars: 2,
    Severity: Minor
    Found in examples/helloworld/public/javascripts/controls.js - About 1 hr to fix

      Function select has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        select: function(element, value) {
          if (Object.isUndefined(value))
            return this[element.type == 'select-one' ?
              'selectOne' : 'selectMany'](element);
          else {
      Severity: Minor
      Found in examples/helloworld/public/javascripts/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 setRequestHeaders has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        setRequestHeaders: function() {
          var headers = {
            'X-Requested-With': 'XMLHttpRequest',
            'X-Prototype-Version': Prototype.Version,
            'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
      Severity: Minor
      Found in examples/helloworld/public/javascripts/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 getElementsByClassName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
        function iter(name) {
          return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
        }
      
      
      Severity: Minor
      Found in examples/helloworld/public/javascripts/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 setStyle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        setStyle: function(element, styles) {
          element = $(element);
          var elementStyle = element.style, match;
          if (Object.isString(styles)) {
            element.style.cssText += ';' + styles;
      Severity: Minor
      Found in examples/helloworld/public/javascripts/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 stopObserving has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function stopObserving(element, eventName, handler) {
          element = $(element);
      
          var registry = Element.retrieve(element, 'prototype_event_registry');
      
      
      Severity: Minor
      Found in examples/helloworld/public/javascripts/prototype.js - About 1 hr to fix

        Function baseInitialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          baseInitialize: function(element, update, options) {
            element          = $(element);
            this.element     = element;
            this.update      = $(update);
            this.hasFocus    = false;
        Severity: Minor
        Found in examples/helloworld/public/javascripts/controls.js - About 1 hr to fix

          Function setup has 37 lines of code (exceeds 25 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 examples/helloworld/public/javascripts/effects.js - About 1 hr to fix

            Function start has 36 lines of code (exceeds 25 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 examples/helloworld/public/javascripts/effects.js - About 1 hr to fix

              Function finishDrag has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                finishDrag: function(event, success) {
                  this.dragging = false;
              
                  if(this.options.quiet){
                    Position.prepare();
              Severity: Minor
              Found in examples/helloworld/public/javascripts/dragdrop.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
                            submit !== false && (!submit || key == submit) && (submitted = true)))) {
                          if (key in result) {
                            if (!Object.isArray(result[key])) result[key] = [result[key]];
                            result[key].push(value);
                Severity: Critical
                Found in examples/helloworld/public/javascripts/prototype.js - About 1 hr to fix

                  Function onKeyPress has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    onKeyPress: function(event) {
                      if(this.active)
                        switch(event.keyCode) {
                         case Event.KEY_TAB:
                         case Event.KEY_RETURN:
                  Severity: Minor
                  Found in examples/helloworld/public/javascripts/controls.js - About 1 hr to fix

                    Function selector has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          selector: function(instance) {
                            var ret       = []; // Beginning matches
                            var partial   = []; // Inside matches
                            var entry     = instance.getToken();
                            var count     = 0;
                    Severity: Minor
                    Found in examples/helloworld/public/javascripts/controls.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language