zammad/zammad

View on GitHub
app/assets/javascripts/app/lib/flot/jquery.flot.pie.js

Summary

Maintainability
F
6 days
Test Coverage

Function init has 495 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function init(plot) // this is the "body" of the plugin
    {
        var canvas = null;
        var target = null;
        var maxRadius = null;
Severity: Major
Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 2 days to fix

    File jquery.flot.pie.js has 545 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
    Flot plugin for rendering pie charts. The plugin assumes the data is 
    coming is as a single data value for each series, and each of those 
    values is a positive value or zero (negative numbers don't make 
    any sense and will cause strange effects). The data values do 
    Severity: Major
    Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 1 day to fix

      Function draw has 156 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function draw(plot, newCtx)
              {
                  if (!target) return; // if no series were passed
                  ctx = newCtx;
              
      Severity: Major
      Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 6 hrs to fix

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

                    function drawPie()
                    {
                        startAngle = Math.PI*options.series.pie.startAngle;
                        
                        // set radius
        Severity: Major
        Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 3 hrs to fix

          Function findNearbySlice has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function findNearbySlice(mouseX, mouseY)
                  {
                      var slices = plot.getData(),
                          options = plot.getOptions(),
                          radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
          Severity: Minor
          Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 1 hr to fix

            Function drawLabels has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                            function drawLabels()
                            {
                                var currentAngle = startAngle;
                                
                                // set radius
            Severity: Minor
            Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 1 hr to fix

              Function combine has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function combine(data)
                      {
                          data = fixData(data);
                          calcTotal(data);
                          var combined = 0;
              Severity: Minor
              Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 1 hr to fix

                Function drawLabel has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                    function drawLabel(slice, startAngle, index)
                                    {
                                        if (slice.data[0][1]==0)
                                            return;
                                            
                Severity: Minor
                Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js - About 1 hr to fix

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

                                              $('<div class="pieLabelBackground" style="position:absolute;width:' + label.width() + 'px;height:' + label.height() + 'px;' + pos +'background-color:' + c + ';"> </div>').insertBefore(label).css('opacity', options.series.pie.label.background.opacity);
                  Severity: Major
                  Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/app/lib/flot/jquery.flot.js on lines 2244..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 64.

                  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

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

                                  radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
                  Severity: Major
                  Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/app/lib/flot/jquery.flot.pie.js on lines 670..670

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

                  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

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

                              var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
                  Severity: Major
                  Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/app/lib/flot/jquery.flot.pie.js on lines 527..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 55.

                  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 (options.series.pie.show && options.grid.clickable)
                                  eventHolder.off('click').on('click', onClick);
                  Severity: Minor
                  Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/app/lib/flot/jquery.flot.pie.js on lines 127..128

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

                  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 (options.series.pie.show && options.grid.hoverable)
                                  eventHolder.off('mousemove').on('mousemove', onMouseMove);
                  Severity: Minor
                  Found in app/assets/javascripts/app/lib/flot/jquery.flot.pie.js and 1 other location - About 40 mins to fix
                  app/assets/javascripts/app/lib/flot/jquery.flot.pie.js on lines 130..131

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

                  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

                  There are no issues that match your filters.

                  Category
                  Status