estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Function Arc has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        Arc : function(params) {
            var self = this,
                _super = jsPlumb.Segments.AbstractSegment.apply(this, arguments),
                _calcAngle = function(_x, _y) {
                    return jsPlumbUtil.theta([params.cx, params.cy], [_x, _y]);    
Severity: Major
Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

    Function redraw has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            this.redraw = function(elementId, ui, timestamp, offsetToUI, clearEdits) {
            
                if (!jsPlumbInstance.isSuspendDrawing()) {
                    // get all the endpoints for this element
                    var ep = _amEndpoints[elementId] || [],
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

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

          'contains': function(node, pos) {
            var dim  = node.getData('dim'),
                npos = this.getAlignedPos(node.pos.getc(true), dim, dim),
                dim2 = dim/2;
            this.nodeHelper.circle.contains({x:npos.x+dim2, y:npos.y+dim2}, pos, dim2);
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 9833..9838

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

      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

          'contains': function(node, pos) {
            var dim  = node.getData('dim'),
                npos = this.getAlignedPos(node.pos.getc(true), dim, dim),
                dim2 = dim/2;
            this.nodeHelper.square.contains({x:npos.x+dim2, y:npos.y+dim2}, pos, dim2);
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 9819..9824

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

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

          var AbstractDOMOverlay = function(params) {
              jsPlumb.DOMElementComponent.apply(this, arguments);
              AbstractOverlay.apply(this, arguments);
              
              var self = this, initialised = false, jpcl = jsPlumb.CurrentLibrary;
      Severity: Major
      Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 3 hrs to fix

        Function fill has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                fill: function() {
                    var d = new Date(this.viewDate),
                        year = d.getUTCFullYear(),
                        month = d.getUTCMonth(),
                        startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
        Severity: Major
        Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

          Function render has 93 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              'render' : function(node, canvas) {
                var pos = node.pos.getc(true), 
                    width = node.getData('width'),
                    height = node.getData('height'),
                    algnPos = this.getAlignedPos(pos, width, height),
          Severity: Major
          Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

            Function click has 92 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    click: function(e) {
                        e.preventDefault();
                        var target = $(e.target).closest('span, td, th');
                        if (target.length == 1) {
                            switch(target[0].nodeName.toLowerCase()) {
            Severity: Major
            Found in app/assets/javascripts/bootstrap-datepicker.js - About 3 hrs to fix

              Function SpkMultiWidget has 92 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function SpkMultiWidget(helperId) {
                  this.helperId = helperId;
                  allMultiWidgets[""+helperId] = this;
                  this.eventHandlers = new Array();
                  this.refreshIntervalSecs = REFRESH_SECS;
              Severity: Major
              Found in app/assets/javascripts/spk_multiwidget.js - About 3 hrs to fix

                Function render has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    'render' : function(node, canvas) {
                      var pos = node.pos.getc(true), 
                          width = node.getData('width'),
                          height = node.getData('height'),
                          algnPos = this.getAlignedPos(pos, width, height),
                Severity: Major
                Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

                  Function URI has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      URI : function(uri) { // See RFC3986
                  
                          this.scheme = null;
                          this.authority = null;
                          this.path = '';
                  Severity: Major
                  Found in app/assets/javascripts/jscolor.js - About 3 hrs to fix

                    Method update has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def update
                        @module_project = ModuleProject.find(params[:id])
                        @project = @module_project.project
                    
                        authorize! :alter_estimation_plan, @project
                    Severity: Major
                    Found in app/controllers/module_projects_controller.rb - About 3 hrs to fix

                      Method checkout has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def checkout
                          old_prj = Project.find(params[:project_id])
                      
                          authorize! :commit_project, old_prj
                      
                      
                      Severity: Major
                      Found in app/controllers/projects_controller.rb - About 3 hrs to fix

                        Function SpkMultiWidget has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function SpkMultiWidget(helperId) {
                            this.helperId = helperId;
                            allMultiWidgets[""+helperId] = this;
                            this.eventHandlers = new Array();
                            this.refreshIntervalSecs = REFRESH_SECS;
                        Severity: Minor
                        Found in app/assets/javascripts/spk_multiwidget.js - 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

                        Method generate_report has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def generate_report
                        
                            conditions = Hash.new
                            params[:report].each do |i|
                              unless i.last.blank? or i.last.nil?
                        Severity: Minor
                        Found in app/controllers/organizations_controller.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

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

                              if old_mp.view
                                old_mp_view_widgets = old_mp.view.views_widgets.all
                                old_mp_view_widgets.each do |old_view_widget|
                                  new_view_widget_mp = ModuleProject.find_by_project_id_and_copy_id(new_prj.id, old_view_widget.module_project_id)
                                  new_view_widget_mp_id = new_view_widget_mp.nil? ? nil : new_view_widget_mp.id
                        Severity: Major
                        Found in app/controllers/projects_controller.rb and 1 other location - About 3 hrs to fix
                        app/models/project.rb on lines 348..368

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

                        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 old_mp.view
                                      old_mp_view_widgets = old_mp.view.views_widgets.all
                                      old_mp_view_widgets.each do |view_widget|
                                        new_view_widget_mp = ModuleProject.find_by_project_id_and_copy_id(new_prj.id, view_widget.module_project_id)
                                        new_view_widget_mp_id = new_view_widget_mp.nil? ? nil : new_view_widget_mp.id
                        Severity: Major
                        Found in app/models/project.rb and 1 other location - About 3 hrs to fix
                        app/controllers/projects_controller.rb on lines 1427..1447

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

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

                          def initialize(user, organization)
                        
                            #Uncomment in order to authorize everybody to manage all the app
                            if Rails.env == "test" || user.super_admin == true
                              can :manage, :all
                        Severity: Major
                        Found in app/models/ability.rb - About 3 hrs to fix

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

                                      if (config.yAxisLeft) {
                                          if (reverseAxis == false) leftNotUsableSize = borderWidth + config.spaceLeft + yAxisLabelWidth + widestYLabel + 3 + config.yAxisSpaceLeft + config.yAxisSpaceRight;
                                          else leftNotUsableSize = borderWidth + config.spaceLeft + yAxisLabelWidth + widestXLabel + 3 + config.yAxisSpaceLeft + config.yAxisSpaceRight;
                                      }
                          Severity: Major
                          Found in app/assets/javascripts/ChartNew.js and 1 other location - About 3 hrs to fix
                          app/assets/javascripts/ChartNew.js on lines 4231..4234

                          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 ((b.x1 >= a.x1 && b.x1 <= a.x2) ||
                                      (b.x2 >= a.x1 && b.x2 <= a.x2) ||
                                      (a.x1 >= b.x1 && a.x2 <= b.x2)
                                  ) { x = true; }
                          Severity: Major
                          Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 3 hrs to fix
                          app/assets/javascripts/jquery.gridster.js on lines 195..198

                          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

                          Severity
                          Category
                          Status
                          Source
                          Language