estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

    $.tablesorter.addParser({
        id: "select",
        is: function(){
            return false;
        },
Severity: Major
Found in app/assets/javascripts/pager.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/pager.js on lines 2923..2932

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

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

            xLabelHeight = Math.abs(Math.sin(rotateLabels * Math.PI / 180) * widestLabel) + Math.abs(Math.sin((rotateLabels + 90) * Math.PI / 180) * config.scaleFontSize) + config.xAxisSpaceBefore + config.xAxisSpaceAfter;
Severity: Major
Found in app/assets/javascripts/ChartNew.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/ChartNew.js on lines 4365..4365

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

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

            xLabelWidth = Math.abs(Math.cos(rotateLabels * Math.PI / 180) * widestLabel) + Math.abs(Math.cos((rotateLabels + 90) * Math.PI / 180) * config.scaleFontSize);
Severity: Major
Found in app/assets/javascripts/ChartNew.js and 1 other location - About 2 hrs to fix
app/assets/javascripts/ChartNew.js on lines 4363..4363

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

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

  def self.import(file, sep, encoding)
    sep = "#{sep.blank? ? I18n.t(:general_csv_separator) : sep}"
    error_count = 0
    CSV.open(file.path, 'r', :quote_char => "\"", :row_sep => :auto, :col_sep => sep, :encoding => "#{encoding}:utf-8") do |csv|
      csv.each_with_index do |row, i|
Severity: Minor
Found in app/models/wbs_activity_ratio.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 can_do_action_on_estimation? has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def can_do_action_on_estimation?(estimation, project_permission_action_alias)
    can_do_something = false

    # SuperAdmin user or those who has all permissions has all rights
    if current_user.super_admin? || can?(:manage, :all)
Severity: Minor
Found in app/helpers/projects_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

Method import_user has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def import_user
    sep = "#{params[:separator].blank? ? I18n.t(:general_csv_separator) : params[:separator]}"
    error_count = 0
    file = params[:file]
    encoding = params[:encoding]
Severity: Minor
Found in app/controllers/organizations_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 compute_component_estimation_value has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def compute_component_estimation_value(component, pe_attribute_id, level_estimation_value, wbs_project_elt_root=nil)
    #No authorize required since this method is private and won't be call from any route
    component_children_results_array = Array.new
    new_effort_person_hour = Hash.new
    pe_attribute = PeAttribute.find(pe_attribute_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 computePositions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  computePositions : function(property, getLength) {
    var propArray = property;
    var graph = this.graph;
    var root = graph.getNode(this.root);
    var parent = this.parent;
Severity: Major
Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

    Function svg has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var SvgConnector = jsPlumb.ConnectorRenderers.svg = function(params) {
            var self = this,
                _super = SvgComponent.apply(this, [ { 
                    cssClass:params["_jsPlumb"].connectorClass, 
                    originalArgs:arguments, 
    Severity: Major
    Found in app/assets/javascripts/jquery.jsPlumb-1.4.1-all.js - About 2 hrs to fix

      Function updateUI has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function updateUI() {
      
                  textInput.removeClass("sp-validation-error");
      
                  updateHelperLocations();
      Severity: Major
      Found in app/assets/javascripts/spectrum.js - About 2 hrs to fix

        Function construct has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    ts.construct = function(settings) {
                        return this.each(function() {
                            // if no thead or tbody, or tablesorter is already present, quit
                            if (!this.tHead || this.tBodies.length === 0 || this.hasInitialized === true) {
                                return (this.config && this.config.debug) ? log('stopping initialization! No thead, tbody or tablesorter has already been initialized') : '';
        Severity: Major
        Found in app/assets/javascripts/pager.js - About 2 hrs to fix

          Method create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def create
              authorize! :manage_estimation_widgets, @project
          
              # Add the position_x and position_y to params
              @view_id = params[:views_widget][:view_id]
          Severity: Major
          Found in app/controllers/views_widgets_controller.rb - About 2 hrs to fix

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

                $("#project_security_level").change(function() {
                    return $.ajax({
                        url: "/update_project_security_level",
                        data: "project_security_level=" + $(this).val() + "&user_id=" + $("#user_id").val()
                    });
            Severity: Major
            Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/projestimate_script.js on lines 529..534

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

            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 (storedSizes) {
                            for (column in storedSizes) {
                                if (!isNaN(column) && column < c.$headers.length) {
                                    c.$headers.eq(column).width(storedSizes[column]); // set saved resizable widths
                                }
            Severity: Major
            Found in app/assets/javascripts/tablesorter.min.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/pager.js on lines 2744..2750

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

            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

                $("#project_security_level_group").change(function() {
                    return $.ajax({
                        url: "/update_project_security_level_group",
                        data: "project_security_level=" + $(this).val() + "&group_id=" + $("#group_id").val()
                    });
            Severity: Major
            Found in app/assets/javascripts/projestimate_script.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/projestimate_script.js on lines 522..527

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

            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

                          "rgb("  + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
            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 1275..1275

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

            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

                          "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
            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 1274..1274

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

            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 (s){
                            for (j in s){
                                if (!isNaN(j) && j < c.$headers.length){
                                    c.$headers.eq(j).width(s[j]); // set saved resizable widths
                                }
            Severity: Major
            Found in app/assets/javascripts/pager.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/tablesorter.min.js on lines 1885..1891

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

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

                placeLabel: function(tag, node, controller) {
                    var pos = node.pos.getc(true), 
                        config = this.viz.config, 
                        dim = config.Node, 
                        canvas = this.viz.canvas,
            Severity: Major
            Found in app/assets/javascripts/jit-2.0.1.js - About 2 hrs to fix

              Function buildRow has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      buildRow: function(table, c, wo) {
                          var col, column, $header, buildSelect, disabled, name, ffxn,
                          // c.columns defined in computeThIndexes()
                              columns = c.columns,
                              arry = $.isArray(wo.filter_cellFilter),
              Severity: Major
              Found in app/assets/javascripts/tablesorter.min.js - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language