estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Function dispCrossText has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function dispCrossText(ctx, config, posX, posY, borderX, borderY, overlay, data, animPC) {
        var i, disptxt, txtposx, txtposy, txtAlign, txtBaseline;

        for (i = 0; i < config.crossText.length; i++) {
            if (config.crossText[i] != "" && config.crossTextOverlay[Min([i, config.crossTextOverlay.length - 1])] == overlay) {
Severity: Major
Found in app/assets/javascripts/ChartNew.js - About 3 hrs to fix

    Method get_chart_data_by_phase_and_profile has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def get_chart_data_by_phase_and_profile(pbs_project_element, module_project, estimation_value, view_widget)
        result = String.new
        stacked_data = Array.new
        profiles_wbs_data = Hash.new
        probable_est_value = estimation_value.send("string_data_probable")
    Severity: Major
    Found in app/helpers/views_widgets_helper.rb - About 3 hrs to fix

      File organization_duplicate_project_worker.rb has 303 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class OrganizationDuplicateProjectWorker
        include Sidekiq::Worker
      
        def perform(est_model_id, new_organization_id, user_id)
          est_model = Project.find(est_model_id)
      Severity: Minor
      Found in app/workers/organization_duplicate_project_worker.rb - About 3 hrs to fix

        Method display_inputs_without_activities has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def display_inputs_without_activities(module_project)
            pbs_project_element = current_component
            res = String.new
        
            if module_project.compatible_with(current_component.work_element_type.alias) || current_component
        Severity: Minor
        Found in app/helpers/projects_helper.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

          contextPrototype.moveTo = function(aX, aY) {
            var p = getCoords(this, aX, aY);
            this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y});
            this.currentX_ = p.x;
            this.currentY_ = p.y;
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/jit-2.0.1-excanvas.js on lines 630..636

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

        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

          contextPrototype.lineTo = function(aX, aY) {
            var p = getCoords(this, aX, aY);
            this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y});
        
            this.currentX_ = p.x;
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1-excanvas.js and 1 other location - About 3 hrs to fix
        app/assets/javascripts/jit-2.0.1-excanvas.js on lines 623..628

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

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

          plotElement: function(elem, canvas, opt) {
            var gl = canvas.getCtx(),
                viewMatrix = new Matrix4,
                lighting = canvas.config.Scene.Lighting,
                wcanvas = canvas.canvases[0],
        Severity: Major
        Found in app/assets/javascripts/jit-2.0.1.js - About 3 hrs to fix

          Method display_balancing_input has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def display_balancing_input(module_project, last_estimation_result)
              pbs_project_element = current_component
              #Get the current balancing attribute
              @current_balancing_attribute = current_balancing_attribute
          
          
          Severity: Major
          Found in app/helpers/projects_helper.rb - About 3 hrs to fix

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

                    format: function(s, table) {
                        var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ""), table);
                        return s && typeof n === 'number' ? n : s ? $.trim( s && table.config.ignoreCase ? s.toLocaleLowerCase() : s ) : s;
                    },
            Severity: Major
            Found in app/assets/javascripts/pager.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/pager.js on lines 1517..1520

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

            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

                    format: function(s, table) {
                        var n = ts.formatFloat((s || '').replace(/[^\w,. \-()]/g, ""), table);
                        return s && typeof n === 'number' ? n : s ? $.trim( s && table.config.ignoreCase ? s.toLocaleLowerCase() : s ) : s;
                    },
            Severity: Major
            Found in app/assets/javascripts/pager.js and 1 other location - About 3 hrs to fix
            app/assets/javascripts/pager.js on lines 1505..1508

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

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

                    function drawPieSegments(animationDecimal) {
            
            
            
                        var cumulativeAngle = -config.startAngle * (Math.PI / 180)+2*Math.PI ,
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js - About 3 hrs to fix

              Function appendFill has 79 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function appendFill(ctx, lineStr, min, max) {
                  var fillStyle = ctx.fillStyle;
                  var arcScaleX = ctx.arcScaleX_;
                  var arcScaleY = ctx.arcScaleY_;
                  var width = max.x - min.x;
              Severity: Major
              Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix

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

                        this._compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
                            var width = endpointStyle.width || self.width,
                            height = endpointStyle.height || self.height,
                            x = anchorPoint[0] - (width/2),
                            y = anchorPoint[1] - (height/2);
                Severity: Major
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 6907..6914

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

                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 (k = 0; k < b.length; k++ ){
                                $tb = ts.processTbody(table, b.eq(k), true); // remove tbody
                                $tb.children().removeClass(wo.filter_filteredRow).show();
                                ts.processTbody(table, $tb, false); // restore tbody
                            }
                Severity: Major
                Found in app/assets/javascripts/pager.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/tablesorter.min.js on lines 400..404

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

                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 (tbodyIndex = 0; tbodyIndex < $tbodies.length; tbodyIndex++ ) {
                                $tbody = ts.processTbody(table, $tbodies.eq(tbodyIndex), true); // remove tbody
                                $tbody.children().removeClass(wo.filter_filteredRow).show();
                                ts.processTbody(table, $tbody, false); // restore tbody
                            }
                Severity: Major
                Found in app/assets/javascripts/tablesorter.min.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/pager.js on lines 2502..2506

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

                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._compute = function(anchorPoint, orientation, endpointStyle, connectorPaintStyle) {
                            var width = endpointStyle.width || self.width,
                                height = endpointStyle.height || self.height,
                                x = anchorPoint[0] - (width/2),
                                y = anchorPoint[1] - (height/2);
                Severity: Major
                Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js and 1 other location - About 3 hrs to fix
                app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js on lines 7083..7089

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

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

                            function initSort(table, cell, e){
                                var a, i, j, o, s,
                                    c = table.config,
                                    k = !e[c.sortMultiSortKey],
                                    $this = $(table);
                Severity: Major
                Found in app/assets/javascripts/pager.js - About 3 hrs to fix

                  Method import has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.import(file, sep)
                      #find localstatus
                      @localstatus = RecordStatus.find_by_name('Local')
                  
                      #create wbs_activity
                  Severity: Minor
                  Found in app/models/wbs_activity_element.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

                  Method append_pemodule has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def append_pemodule
                      @project = Project.find(params[:project_id])
                      @pemodule = Pemodule.find(params[:module_selected].split(',').last.to_i)
                  
                      authorize! :alter_estimation_plan, @project
                  Severity: Minor
                  Found in app/controllers/projects_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

                  Function drawImage has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    contextPrototype.drawImage = function(image, var_args) {
                      var dx, dy, dw, dh, sx, sy, sw, sh;
                  
                      // to find the original width we overide the width and height
                      var oldRuntimeWidth = image.runtimeStyle.width;
                  Severity: Major
                  Found in app/assets/javascripts/jit-2.0.1-excanvas.js - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language