estimancy/projestimate

View on GitHub

Showing 1,675 of 1,675 total issues

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

            for (var i = 0; i < data.datasets.length; i++) { for (var j = 0; j < data.datasets[i].data.length; j++) { totvalue[j] += data.datasets[i].data[j]; maxvalue[j] = Max([maxvalue[j], data.datasets[i].data[j]]); } }
Severity: Major
Found in app/assets/javascripts/ChartNew.js and 1 other location - About 5 hrs to fix
app/assets/javascripts/ChartNew.js on lines 1547..1547

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

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

    var PolarArea = function (data, config, ctx) {
        var maxSize, scaleHop, calculatedScale, labelHeight, scaleHeight, valueBounds, labelTemplateString, msr, midPosX, midPosY;

        if (!dynamicFunction(data,config,ctx,"PolarArea"))return;

Severity: Major
Found in app/assets/javascripts/ChartNew.js - About 4 hrs to fix

    Function bindEvents has 123 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function bindEvents(table){
                    var c = table.config,
                        $this = c.$table,
                        j, downTime;
                    // apply event handling to headers
    Severity: Major
    Found in app/assets/javascripts/pager.js - About 4 hrs to fix

      Method update has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def update
          authorize! :manage_estimation_widgets, @project
      
          @views_widget = ViewsWidget.find(params[:id])
          @view_id = @views_widget.view_id
      Severity: Minor
      Found in app/controllers/views_widgets_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

      Method update_views_and_widgets has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def update_views_and_widgets(new_prj, old_mp, new_mp)
          #For initialization module level
          if old_mp.pemodule.alias == Projestimate::Application::INITIALIZATION
            #Copy the views and widgets for the new project
            new_view = View.create(organization_id: new_prj.organization_id, name: "#{new_prj.to_s} : view for #{new_mp.to_s}", description: "Please rename the view's name and description if needed.")
      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

      Method restore_change has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

        def restore_change
          authorize! :manage_master_data, :all
      
          #get the record controller name
          controller = params[:controller]    #controller.controller_name
      Severity: Minor
      Found in lib/data_validation_helper.rb - About 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

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

          callback = {
            onComplete: function() {
              that.clickedNode = parent;
              if(config.request) {
                that.requestNodes(parent, {
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 13903..13920

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

      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

          callback = {
            onComplete: function() {
              that.clickedNode = parent;
              if(config.request) {
                that.requestNodes(parent, {
      Severity: Major
      Found in app/assets/javascripts/jit-2.0.1.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/jit-2.0.1.js on lines 15300..15317

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

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

              function drawBars(animPc) {
                  ctx.lineWidth = config.barStrokeWidth;
                  var yStart = new Array(data.datasets.length);
      
                  var cumvalue = new Array();
      Severity: Major
      Found in app/assets/javascripts/ChartNew.js - About 4 hrs to fix

        Method included has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.included(base)
        
            base.class_eval do
        
              #self relation on master data : Parent<->Child
        Severity: Major
        Found in lib/master_data_helper.rb - About 4 hrs to fix

          Function drawBars has 120 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function drawBars(animPc) {
                      ctx.lineWidth = config.barStrokeWidth;
                      var yStart = new Array(data.datasets.length);
          
                      var cumvalue = new Array();
          Severity: Major
          Found in app/assets/javascripts/ChartNew.js - About 4 hrs to fix

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

                                     if(config.inGraphDataAnglePosition==1)posAngle=realCumulativeAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
                                     else if(config.inGraphDataAnglePosition==2)posAngle=realCumulativeAngle-segmentAngle/2+config.inGraphDataPaddingAngle*(Math.PI/180);
                                     else if(config.inGraphDataAnglePosition==3)posAngle=realCumulativeAngle-segmentAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js and 3 other locations - About 4 hrs to fix
            app/assets/javascripts/ChartNew.js on lines 1989..1991
            app/assets/javascripts/ChartNew.js on lines 2104..2106
            app/assets/javascripts/ChartNew.js on lines 2188..2190

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

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

                              if(config.inGraphDataAnglePosition==1)posAngle=realCumulativeAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
                              else if(config.inGraphDataAnglePosition==2)posAngle=realCumulativeAngle-segmentAngle/2+config.inGraphDataPaddingAngle*(Math.PI/180);
                              else if(config.inGraphDataAnglePosition==3)posAngle=realCumulativeAngle-segmentAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js and 3 other locations - About 4 hrs to fix
            app/assets/javascripts/ChartNew.js on lines 1906..1908
            app/assets/javascripts/ChartNew.js on lines 2104..2106
            app/assets/javascripts/ChartNew.js on lines 2188..2190

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

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

                              if(config.inGraphDataAnglePosition==1)posAngle=realCumulativeAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
                              else if(config.inGraphDataAnglePosition==2)posAngle=realCumulativeAngle-segmentAngle/2+config.inGraphDataPaddingAngle*(Math.PI/180);
                              else if(config.inGraphDataAnglePosition==3)posAngle=realCumulativeAngle-segmentAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js and 3 other locations - About 4 hrs to fix
            app/assets/javascripts/ChartNew.js on lines 1906..1908
            app/assets/javascripts/ChartNew.js on lines 1989..1991
            app/assets/javascripts/ChartNew.js on lines 2104..2106

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

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

                                     if(config.inGraphDataAnglePosition==1)posAngle=realCumulativeAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
                                     else if(config.inGraphDataAnglePosition==2)posAngle=realCumulativeAngle-segmentAngle/2+config.inGraphDataPaddingAngle*(Math.PI/180);
                                     else if(config.inGraphDataAnglePosition==3)posAngle=realCumulativeAngle-segmentAngle+config.inGraphDataPaddingAngle*(Math.PI/180);
            Severity: Major
            Found in app/assets/javascripts/ChartNew.js and 3 other locations - About 4 hrs to fix
            app/assets/javascripts/ChartNew.js on lines 1906..1908
            app/assets/javascripts/ChartNew.js on lines 1989..1991
            app/assets/javascripts/ChartNew.js on lines 2188..2190

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

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

                morph: function(json, opt, extraModes) {
                    extraModes = extraModes || {};
                    var viz = this.viz;
                    var options = $.merge(this.options, viz.controller, opt), root = viz.root;
                    var graph;
            Severity: Major
            Found in app/assets/javascripts/jit-2.0.1.js - About 4 hrs to fix

              Method load_master_data! has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.load_master_data!
                  db=Home::connect_external_database
                  #begin
                  record_status = ExternalMasterDatabase::ExternalRecordStatus.all
                  record_status.each do |i|
              Severity: Minor
              Found in app/models/home.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

              Method dashboard has a Cognitive Complexity of 32 (exceeds 5 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: 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

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

              ;(function($){
                  $.fn.datepicker.dates['frsncf'] = {
                      days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
                      daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
                      daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
              app/assets/javascripts/locales/bootstrap-datepicker.de-AT.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.de-CH.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.de.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.en-AU.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en-CA.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en-GB.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.es-ES.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr-BE.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr-CA.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr-CH.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr.js on lines 5..16

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

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

              ;(function($){
                  $.fn.datepicker.dates['fr'] = {
                      days: ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"],
                      daysShort: ["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam", "Dim"],
                      daysMin: ["D", "L", "Ma", "Me", "J", "V", "S", "D"],
              app/assets/javascripts/locales/bootstrap-datepicker.de-AT.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.de-CH.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.de.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.en-AU.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en-CA.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en-GB.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.en.js on lines 4..15
              app/assets/javascripts/locales/bootstrap-datepicker.es-ES.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr-BE.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr-CA.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.fr.js on lines 5..16
              app/assets/javascripts/locales/bootstrap-datepicker.frsncf.js on lines 5..16

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

              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