estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

    jsPlumb.Endpoints.vml.Dot = function() {
        jsPlumb.Endpoints.Dot.apply(this, arguments);
        VmlEndpoint.apply(this, arguments);
        this.getVml = function(d, atts, anchor, parent, _jsPlumb) { return _node("oval", d, atts, parent, _jsPlumb); };
    };
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 8520..8524

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

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

        for (i = opts.cols; i >= 0; i--) {
            styles += (opts.namespace + ' [data-col="'+ (i + 1) + '"] { left:' +
                ((i * opts.widget_base_dimensions[0]) +
                (i * opts.widget_margins[0]) +
                ((i + 1) * opts.widget_margins[0])) + 'px; }\n');
Severity: Major
Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/jquery.gridster.js on lines 3677..3682

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

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

    jsPlumb.Endpoints.vml.Rectangle = function() {
        jsPlumb.Endpoints.Rectangle.apply(this, arguments);
        VmlEndpoint.apply(this, arguments);
        this.getVml = function(d, atts, anchor, parent, _jsPlumb) { return _node("rect", d, atts, parent, _jsPlumb); };
    };
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 8514..8518

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

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

  def update
    @user = User.find(params[:id])
    if current_user != @user
      authorize! :manage, User
    end
Severity: Minor
Found in app/controllers/users_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 validate_change has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_change
    authorize! :manage_master_data, :all

    #get the record controller name
    controller = params[:controller]    #controller.controller_name
Severity: Minor
Found in lib/data_validation_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

Function out has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  out: function(){
    if(this.busy) return;
    this.busy = true;
    this.events.hoveredNode = false;
    var that = this,
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

    Method generate_report has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def generate_report
    
        conditions = Hash.new
        params[:report].each do |i|
          unless i.last.blank? or i.last.nil?
    Severity: Major
    Found in app/controllers/organizations_controller.rb - About 2 hrs to fix

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

                  switch(max) {
                      case r: h = (g - b) / d + (g < b ? 6 : 0); break;
                      case g: h = (b - r) / d + 2; break;
                      case b: h = (r - g) / d + 4; break;
                  }
      Severity: Major
      Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/spectrum.js on lines 1521..1525

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

      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

                  switch(max) {
                      case r: h = (g - b) / d + (g < b ? 6 : 0); break;
                      case g: h = (b - r) / d + 2; break;
                      case b: h = (r - g) / d + 4; break;
                  }
      Severity: Major
      Found in app/assets/javascripts/spectrum.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/spectrum.js on lines 1587..1591

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

      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

              _unapplyEvents: function(evs){
                  for (var i=0, el, ev; i<evs.length; i++){
                      el = evs[i][0];
                      ev = evs[i][1];
                      el.off(ev);
      Severity: Major
      Found in app/assets/javascripts/bootstrap-datepicker.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/bootstrap-datepicker.js on lines 160..166

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

      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

              _applyEvents: function(evs){
                  for (var i=0, el, ev; i<evs.length; i++){
                      el = evs[i][0];
                      ev = evs[i][1];
                      el.on(ev);
      Severity: Major
      Found in app/assets/javascripts/bootstrap-datepicker.js and 1 other location - About 2 hrs to fix
      app/assets/javascripts/bootstrap-datepicker.js on lines 167..173

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

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

              this.paint = function(params) {
                  
                  if (visible) {
                          
                      params = params || {};
      Severity: Major
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

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

             setRoot: function(id, method, onComplete) {
                    if(this.busy) return;
                    this.busy = true;
                  var that = this, canvas = this.canvas;
                    var rootNode = this.graph.getNode(this.root);
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

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

            out: function(){
              if(this.busy)
                return;
          
              var that = this,
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

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

                jsPlumb.DynamicAnchor = function(params) {
                    jsPlumb.Anchor.apply(this, arguments);
                    
                    this.isSelective = true;
                    this.isDynamic = true;            
            Severity: Major
            Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

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

                      this._compute = function(paintInfo, params) {
                          var w = Math.abs(params.sourcePos[0] - params.targetPos[0]),
                              h = Math.abs(params.sourcePos[1] - params.targetPos[1]),
                              x = Math.min(params.sourcePos[0], params.targetPos[0]),
                              y = Math.min(params.sourcePos[1], params.targetPos[1]);                
              Severity: Major
              Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

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

                  def to_s
                    if self.pemodule.alias == Projestimate::Application::INITIALIZATION
                      self.project.title
                    elsif self.pemodule.alias == "ge"
                      self.ge_model.nil? ? 'Undefined model': self.ge_model.to_s(self)
                Severity: Minor
                Found in app/models/module_project.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 perform has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                  def perform(pbs_project_elt_id, estimation_value_id)
                    #No authorize required since this method is private and won't be call from any route
                
                    pbs_project_elt = PbsProjectElement.find(pbs_project_elt_id)
                    estimation_value = EstimationValue.find(estimation_value_id)
                Severity: Minor
                Found in app/workers/estimations_worker.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 removeEdge has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    removeEdge: function(vertex, opt) {
                        var viz = this.viz;
                        var options = $.merge(this.options, viz.controller, opt);
                        var v = ($.type(vertex[0]) == 'string')? [vertex] : vertex;
                        var i, that, adj;
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

                  Function SvgComponent has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var SvgComponent = function(params) {
                          var self = this,
                              pointerEventsSpec = params.pointerEventsSpec || "all",
                              renderer = {};
                              
                  Severity: Major
                  Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language