OpenFn/OpenFn-Site

View on GitHub

Showing 106 of 106 total issues

Function pJS has a Cognitive Complexity of 566 (exceeds 5 allowed). Consider refactoring.
Open

var pJS = function(tag_id, params){

  var canvas_el = document.querySelector('#'+tag_id+' > .particles-js-canvas-el');

  /* particles.js variables with default values */
Severity: Minor
Found in app/assets/javascripts/particles.js - About 1 wk 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 pJS has 988 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var pJS = function(tag_id, params){

  var canvas_el = document.querySelector('#'+tag_id+' > .particles-js-canvas-el');

  /* particles.js variables with default values */
Severity: Major
Found in app/assets/javascripts/particles.js - About 4 days to fix

    File particles.js has 1081 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* -----------------------------------------------
    /* Author : Vincent Garreau  - vincentgarreau.com
    /* MIT license: http://opensource.org/licenses/MIT
    /* Demo / Generator : vincentgarreau.com/particles.js
    /* GitHub : github.com/VincentGarreau/particles.js
    Severity: Major
    Found in app/assets/javascripts/particles.js - About 2 days to fix

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

            if(pJS.particles.size.anim.enable){
              if(p.size_status == true){
                if(p.radius >= pJS.particles.size.value) p.size_status = false;
                p.radius += p.vs;
              }else{
      Severity: Major
      Found in app/assets/javascripts/particles.js and 1 other location - About 6 hrs to fix
      app/assets/javascripts/particles.js on lines 529..538

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

      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

            if(pJS.particles.opacity.anim.enable) {
              if(p.opacity_status == true) {
                if(p.opacity >= pJS.particles.opacity.value) p.opacity_status = false;
                p.opacity += p.vo;
              }else {
      Severity: Major
      Found in app/assets/javascripts/particles.js and 1 other location - About 6 hrs to fix
      app/assets/javascripts/particles.js on lines 541..550

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

      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

          this.fn.width = function(outer) {
            var el = this instanceof HTMLElement ? this : this[0];
            var computedStyle = window.getComputedStyle(el);
            var value = el.offsetWidth;
            if(computedStyle) {
      Severity: Major
      Found in app/assets/javascripts/support/mgcrea-jquery.js and 1 other location - About 6 hrs to fix
      app/assets/javascripts/support/mgcrea-jquery.js on lines 23..35

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

      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

          this.fn.height = function(outer) {
            var el = this instanceof HTMLElement ? this : this[0];
            var computedStyle = window.getComputedStyle(el);
            var value = el.offsetHeight;
            if(computedStyle) {
      Severity: Major
      Found in app/assets/javascripts/support/mgcrea-jquery.js and 1 other location - About 6 hrs to fix
      app/assets/javascripts/support/mgcrea-jquery.js on lines 37..49

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

      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 particle has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        pJS.fn.particle = function(color, opacity, position){
      
          /* size */
          this.radius = (pJS.particles.size.random ? Math.random() : 1) * pJS.particles.size.value;
          if(pJS.particles.size.anim.enable){
      Severity: Major
      Found in app/assets/javascripts/particles.js - About 4 hrs to fix

        Function link has 110 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                link: function(scope, element, attrs, ngModel) {
                  var savedNodes;
        
                  function combineCallbacks(first,second){
                    if(second && (typeof second === 'function')) {
        Severity: Major
        Found in app/assets/javascripts/support/ui-sortable-master/src/sortable.js - About 4 hrs to fix

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

              if(pJS.particles.size.anim.enable){
                this.size_status = false;
                this.vs = pJS.particles.size.anim.speed / 100;
                if(!pJS.particles.size.anim.sync){
                  this.vs = this.vs * Math.random();
          Severity: Major
          Found in app/assets/javascripts/particles.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/particles.js on lines 307..313

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

          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

              if(pJS.particles.opacity.anim.enable){
                this.opacity_status = false;
                this.vo = pJS.particles.opacity.anim.speed / 100;
                if(!pJS.particles.opacity.anim.sync){
                  this.vo = this.vo * Math.random();
          Severity: Major
          Found in app/assets/javascripts/particles.js and 1 other location - About 4 hrs to fix
          app/assets/javascripts/particles.js on lines 245..251

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

          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 bubbleParticle has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            pJS.fn.modes.bubbleParticle = function(p){
          
              /* on hover event */
              if(pJS.interactivity.events.onhover.enable && isInArray('bubble', pJS.interactivity.events.onhover.mode)){
          
          
          Severity: Major
          Found in app/assets/javascripts/particles.js - About 3 hrs to fix

            Function particlesUpdate has 90 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              pJS.fn.particlesUpdate = function(){
            
                for(var i = 0; i < pJS.particles.array.length; i++){
            
                  /* the particle */
            Severity: Major
            Found in app/assets/javascripts/particles.js - About 3 hrs to fix

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

                      if(color.value.h != undefined && color.value.s != undefined && color.value.l != undefined){
                        this.color.hsl = {
                          h: color.value.h,
                          s: color.value.s,
                          l: color.value.l
              Severity: Major
              Found in app/assets/javascripts/particles.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/particles.js on lines 276..282

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

              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

                      if(color.value.r != undefined && color.value.g != undefined && color.value.b != undefined){
                        this.color.rgb = {
                          r: color.value.r,
                          g: color.value.g,
                          b: color.value.b
              Severity: Major
              Found in app/assets/javascripts/particles.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/particles.js on lines 283..289

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

              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 update_plan has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                def update_plan(params)
                  if (self.client_admin? && self.plan.try(:name) != params[:user][:subscription_plan]) || stripe_coupon.present?
                    plan = Plan.find_by(name: params[:user][:subscription_plan])
                    if self.stripe_customer_token.present?
                      customer = Stripe::Customer.retrieve(self.stripe_customer_token)
              Severity: Minor
              Found in app/models/user.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 draw has 75 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                pJS.fn.particle.prototype.draw = function() {
              
                  var p = this;
              
                  if(p.radius_bubble != undefined){
              Severity: Major
              Found in app/assets/javascripts/particles.js - About 3 hrs to fix

                Function eventsListeners has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  pJS.fn.vendors.eventsListeners = function(){
                
                    /* events target element */
                    if(pJS.interactivity.detect_on == 'window'){
                      pJS.interactivity.el = window;
                Severity: Major
                Found in app/assets/javascripts/particles.js - About 2 hrs to fix

                  Function packeryController has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    var packeryController = function ($rootScope, config, service) {
                  
                      var self = this;
                  
                      self.packeryInstantiated = false;
                  Severity: Major
                  Found in app/assets/javascripts/the_bridge_ng/directives/packery.js - About 2 hrs to fix

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

                            if(pJS.tmp.count_svg >= pJS.particles.number.value){
                              pJS.fn.particlesDraw();
                              if(!pJS.particles.move.enable) cancelRequestAnimFrame(pJS.fn.drawAnimFrame);
                              else pJS.fn.drawAnimFrame = requestAnimFrame(pJS.fn.vendors.draw);
                            }else{
                    Severity: Major
                    Found in app/assets/javascripts/particles.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/particles.js on lines 1329..1335

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language