ciudadanointeligente/partidopublico

View on GitHub
app/assets/javascripts/raphael_frontend.js

Summary

Maintainability
F
5 days
Test Coverage

Function donutChart has 90 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    Raphael.fn.donutChart = function (cx, cy, r, rin, values, labels, stroke, legend, legendElement, colors) {
    var paper = this,
      rad = Math.PI / 180,
      chart = this.set();

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

    Function process has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          process = function (j) {
            var value = values[j],
              angleplus = 360 * value / total,
              popangle = angle + (angleplus / 2),
              color = Raphael.hsb(start, .75, 1),
    Severity: Major
    Found in app/assets/javascripts/raphael_frontend.js - About 2 hrs to fix

      File raphael_frontend.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      $(document).ready(function(){
        var green = "#1AC0A4";
        var green_light = "#23DBB8";
        var green_dark = "#19A58A";
        var sky_light = "#78EEE8";
      Severity: Minor
      Found in app/assets/javascripts/raphael_frontend.js - About 2 hrs to fix

        Function donutChart has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            Raphael.fn.donutChart = function (cx, cy, r, rin, values, labels, stroke, legend, legendElement, colors) {
        Severity: Major
        Found in app/assets/javascripts/raphael_frontend.js - About 1 hr to fix

          Function egreso_ord_front_bar has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Raphael.fn.egreso_ord_front_bar = function(dato){
              var paper = this;
              var bar_width = 300;
              var bar_height = 30;
              var publico_percentage = dato.value_publico / dato.value;
          Severity: Minor
          Found in app/assets/javascripts/raphael_frontend.js - About 1 hr to fix

            Function sector has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                function sector(cx, cy, r, startAngle, endAngle, params) {
            Severity: Minor
            Found in app/assets/javascripts/raphael_frontend.js - About 45 mins to fix

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

                Raphael.fn.ingreso_ord_front_header = function(){
              
                  var paper = this;
              
                  paper.circle(12, 15, 9 )
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/raphael_frontend.js on lines 215..245

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

              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

                Raphael.fn.egreso_ord_front_header = function(){
              
                  var paper = this;
              
                  paper.circle(12, 15, 9 )
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/raphael_frontend.js on lines 136..166

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

              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

                Raphael.fn.ingreso_ord_front_footer = function(dato){
                  var paper = this;
                  var bar_width = 300;
                  var bar_height = 30;
                  var publico_width = (dato.publicos / (dato.publicos + dato.privados)) * bar_width;
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/raphael_frontend.js on lines 280..297

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

              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

                Raphael.fn.egreso_ord_front_footer = function(dato){
                  var paper = this;
                  var bar_width = 300;
                  var bar_height = 30;
                  var publico_width = (dato.publicos / (dato.publicos + dato.privados)) * bar_width;
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 6 hrs to fix
              app/assets/javascripts/raphael_frontend.js on lines 196..213

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

              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 'hombres':
                              legendElement.append('<li><i class="fa fa-circle" aria-hidden="true" data-id='+ bcolor +' style="color:' + bcolor + ';"></i> ' + labels[j] + " : " + Math.floor(values[j]) + '</li>');
                              break;
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/raphael_frontend.js on lines 55..57

              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

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

                            case 'mujeres':
                              legendElement.append('<li><i class="fa fa-circle" aria-hidden="true" data-id='+ bcolor +' style="color:' + bcolor + ';"></i> ' + labels[j] + " : " + Math.floor(values[j]) + '</li>');
                              break;
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/raphael_frontend.js on lines 52..54

              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

                Raphael.fn.no_data_chart = function(){
                  this.text(20 , 20, "No hay datos")
                       .attr({
                         "font-family" : "Karla-Regular, Karla",
                         "font-size" : 30,
              Severity: Major
              Found in app/assets/javascripts/raphael_frontend.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/raphael_compare.js on lines 374..382

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

              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