estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

Function table_sorter_filter has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$(function table_sorter_filter() {

    var pagerOptions = {

        // target the pager markup - see the HTML block below
Severity: Major
Found in app/assets/javascripts/pager.js - About 4 hrs to fix

    Function findRows has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        findRows = function(filter, v, cv){
                            var $tb, $tr, $td, cr, r, l, ff, time, r1, r2, searchFiltered;
                            if (c.debug) { time = new Date(); }
                            for (k = 0; k < b.length; k++ ){
                                if (b.eq(k).hasClass(c.cssInfoBlock)) { continue; } // ignore info blocks, issue #264
    Severity: Major
    Found in app/assets/javascripts/pager.js - About 4 hrs to fix

      Method display_inputs_with_activities has 113 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def display_inputs_with_activities(module_project, last_estimation_result=nil)
          pbs_project_element = current_component
          res = String.new
          if module_project.compatible_with(current_component.work_element_type.alias)# || current_component
            pemodule = Pemodule.find(module_project.pemodule.id)
      Severity: Major
      Found in app/helpers/projects_helper.rb - About 4 hrs to fix

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

          $.fn.popover = function (option) {
            return this.each(function () {
              var $this = $(this)
                , data = $this.data('popover')
                , options = typeof option == 'object' && option
        Severity: Major
        Found in app/assets/javascripts/bootstrap.js and 4 other locations - About 4 hrs to fix
        app/assets/javascripts/bootstrap.js on lines 1377..1385
        app/assets/javascripts/bootstrap.js on lines 1650..1658
        app/assets/javascripts/bootstrap.js on lines 2124..2132
        app/assets/javascripts/bootstrap.js on lines 2236..2244

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

        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 5 locations. Consider refactoring.
        Open

          $.fn.affix = function (option) {
            return this.each(function () {
              var $this = $(this)
                , data = $this.data('affix')
                , options = typeof option == 'object' && option
        Severity: Major
        Found in app/assets/javascripts/bootstrap.js and 4 other locations - About 4 hrs to fix
        app/assets/javascripts/bootstrap.js on lines 1377..1385
        app/assets/javascripts/bootstrap.js on lines 1496..1504
        app/assets/javascripts/bootstrap.js on lines 1650..1658
        app/assets/javascripts/bootstrap.js on lines 2124..2132

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

        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 5 locations. Consider refactoring.
        Open

          $.fn.tooltip = function ( option ) {
            return this.each(function () {
              var $this = $(this)
                , data = $this.data('tooltip')
                , options = typeof option == 'object' && option
        Severity: Major
        Found in app/assets/javascripts/bootstrap.js and 4 other locations - About 4 hrs to fix
        app/assets/javascripts/bootstrap.js on lines 1496..1504
        app/assets/javascripts/bootstrap.js on lines 1650..1658
        app/assets/javascripts/bootstrap.js on lines 2124..2132
        app/assets/javascripts/bootstrap.js on lines 2236..2244

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

        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 5 locations. Consider refactoring.
        Open

          $.fn.scrollspy = function (option) {
            return this.each(function () {
              var $this = $(this)
                , data = $this.data('scrollspy')
                , options = typeof option == 'object' && option
        Severity: Major
        Found in app/assets/javascripts/bootstrap.js and 4 other locations - About 4 hrs to fix
        app/assets/javascripts/bootstrap.js on lines 1377..1385
        app/assets/javascripts/bootstrap.js on lines 1496..1504
        app/assets/javascripts/bootstrap.js on lines 2124..2132
        app/assets/javascripts/bootstrap.js on lines 2236..2244

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

        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 5 locations. Consider refactoring.
        Open

          $.fn.typeahead = function (option) {
            return this.each(function () {
              var $this = $(this)
                , data = $this.data('typeahead')
                , options = typeof option == 'object' && option
        Severity: Major
        Found in app/assets/javascripts/bootstrap.js and 4 other locations - About 4 hrs to fix
        app/assets/javascripts/bootstrap.js on lines 1377..1385
        app/assets/javascripts/bootstrap.js on lines 1496..1504
        app/assets/javascripts/bootstrap.js on lines 1650..1658
        app/assets/javascripts/bootstrap.js on lines 2236..2244

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

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

                            drop = function() {
        
                                self["removeClass"](_jsPlumb.endpointDropAllowedClass);
                                self["removeClass"](_jsPlumb.endpointDropForbiddenClass);
                                                            
        Severity: Major
        Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 4 hrs to fix

          Method duplicate has 109 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def duplicate
              # To duplicate a project user need to have the "show_project" and "create_project_from_scratch" authorizations
              if params[:action_name] == "duplication"
                authorize! :create_project_from_scratch, Project
                # To Create a project from a template user need to have "create_project_from_template" authorization
          Severity: Major
          Found in app/controllers/projects_controller.rb - About 4 hrs to fix

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

                                        case 'M':
                                            filtered = $(dates[language].monthsShort).filter(function(){
                                                var m = this.slice(0, parts[i].length),
                                                    p = parts[i].slice(0, m.length);
                                                return m == p;
            Severity: Major
            Found in app/assets/javascripts/bootstrap-datepicker.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/bootstrap-datepicker.js on lines 1135..1142

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

            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

                                        case 'MM':
                                            filtered = $(dates[language].months).filter(function(){
                                                var m = this.slice(0, parts[i].length),
                                                    p = parts[i].slice(0, m.length);
                                                return m == p;
            Severity: Major
            Found in app/assets/javascripts/bootstrap-datepicker.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/bootstrap-datepicker.js on lines 1143..1150

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

            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 triad(color) {
                    var hsl = tinycolor(color).toHsl();
                    var h = hsl.h;
                    return [
                        tinycolor(color),
            Severity: Major
            Found in app/assets/javascripts/spectrum.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/spectrum.js on lines 1761..1769

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

            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

                fn.set_widget_max_size = function($widget, max_size) {
                    $widget = typeof $widget === 'number' ?
                        this.$widgets.eq($widget) : $widget;
            
                    if (!$widget.length) { return this; }
            Severity: Major
            Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/jquery.gridster.js on lines 1233..1244

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

            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

                fn.set_widget_min_size = function($widget, min_size) {
                    $widget = typeof $widget === 'number' ?
                        this.$widgets.eq($widget) : $widget;
            
                    if (!$widget.length) { return this; }
            Severity: Major
            Found in app/assets/javascripts/jquery.gridster.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/jquery.gridster.js on lines 1256..1267

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

            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 splitcomplement(color) {
                    var hsl = tinycolor(color).toHsl();
                    var h = hsl.h;
                    return [
                        tinycolor(color),
            Severity: Major
            Found in app/assets/javascripts/spectrum.js and 1 other location - About 4 hrs to fix
            app/assets/javascripts/spectrum.js on lines 1740..1748

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

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

              def self.execute_duplication_SAVE_NOT_WORKING(project_id, parameters, create_from_template = nil)
                #Project.transaction do
                  begin
                    old_prj = Project.find(project_id)
            
            
            Severity: Major
            Found in app/models/project.rb - About 4 hrs to fix

              Method destroy has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                def destroy
                  @project = Project.find(params[:id])
                  authorize! :delete_project, @project
              
                  is_model = @project.is_model
              Severity: Minor
              Found in app/controllers/projects_controller.rb - About 4 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 format has 106 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      format: function(table, c, wo) {
                          if (c.$table.hasClass('hasResizable')) { return; }
                          c.$table.addClass('hasResizable');
                          ts.resizableReset(table, true); // set default widths
                          var $rows, $columns, $column, column, timer,
              Severity: Major
              Found in app/assets/javascripts/tablesorter.min.js - About 4 hrs to fix

                Method dashboard has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def dashboard
                    authorize! :show_project, @project
                
                    # return if user doesn't have the rigth to consult the estimation
                    if !can_show_estimation?(@project)
                Severity: Major
                Found in app/controllers/projects_controller.rb - About 4 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language