Floppy/carbon-diet

View on GitHub

Showing 292 of 292 total issues

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

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

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

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

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

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

        function pointerY(event) {
          var docElement = document.documentElement,
           body = document.body || { scrollTop: 0 };
      
          return  event.pageY || (event.clientY +
      Severity: Major
      Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/standard/prototype.js on lines 5338..5345

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

      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

        function pointerX(event) {
          var docElement = document.documentElement,
           body = document.body || { scrollLeft: 0 };
      
          return event.pageX || (event.clientX +
      Severity: Major
      Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/standard/prototype.js on lines 5347..5354

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

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

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

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

              'bottom': function(element) {
                var offset = element.positionedOffset(),
                 parent = element.getOffsetParent(),
                 pHeight = parent.measure('height');
        
        
        Severity: Major
        Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/standard/prototype.js on lines 3490..3498

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

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

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

              'right': function(element) {
                var offset = element.positionedOffset(),
                 parent = element.getOffsetParent(),
                 pWidth = parent.measure('width');
        
        
        Severity: Major
        Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/standard/prototype.js on lines 3475..3483

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

        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

        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

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

                'right': function(element) {
                  var parent = hasLayout(element.getOffsetParent());
                  var rect = element.getBoundingClientRect(),
                   pRect = parent.getBoundingClientRect();
          
          
          Severity: Major
          Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/standard/prototype.js on lines 3560..3566

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

          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

                'bottom': function(element) {
                  var parent = hasLayout(element.getOffsetParent());
                  var rect = element.getBoundingClientRect(),
                   pRect = parent.getBoundingClientRect();
          
          
          Severity: Major
          Found in app/assets/javascripts/standard/prototype.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/standard/prototype.js on lines 3552..3558

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

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

          Severity
          Category
          Status
          Source
          Language