ciudadanointeligente/partidopublico

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

Summary

Maintainability
F
3 days
Test Coverage

File raphael_compare.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
Open

$(document).ready(function(){
  var bar_width = 300;
  var bar_height = 30;
  var colors_x_edad = ["#FF0000", "#F00000", "#00F000", "#00FF00", "#0000F0", "#0000FF",
                       "#0F0F00", "#FF00F0", "#FF000F", "#FF0F00", "#0FF000", "#FF00FF"]
Severity: Minor
Found in app/assets/javascripts/raphael_compare.js - About 3 hrs to fix

    Function regiones_compare_chart has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      Raphael.fn.regiones_compare_chart = function(datos){
        var paper = this;
        var header_height = 40;
        var line_height = 50;
        var chart_width = 800;
    Severity: Major
    Found in app/assets/javascripts/raphael_compare.js - About 2 hrs to fix

      Function representantes_compare_header has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        Raphael.fn.representantes_compare_header = function(){
          var paper = this;
          paper.circle(12, 15, 9 )
          .attr({
            "fill" : colors_representantes[0],
      Severity: Major
      Found in app/assets/javascripts/raphael_compare.js - About 2 hrs to fix

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

            function regiones_compare_header(){
        
              paper.circle(12, 15, 9 )
              .attr({
                "fill" : "#19A58A",
        Severity: Minor
        Found in app/assets/javascripts/raphael_compare.js - About 1 hr to fix

          Function representantes_compare_bar has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            Raphael.fn.representantes_compare_bar = function(max, val, text){
              var paper = this;
              var width = (val / max) * bar_width;
              var color = 0;
              switch (text) {
          Severity: Minor
          Found in app/assets/javascripts/raphael_compare.js - About 1 hr to fix

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

              Raphael.fn.ingreso_ord_header = function(){
                var paper = this;
                paper.circle(12, 15, 9 )
                .attr({
                  "fill" : "#23DBB8",
            Severity: Major
            Found in app/assets/javascripts/raphael_compare.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/raphael_compare.js on lines 8..35

            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.afiliados_compare_header = function(){
                var paper = this;
                paper.circle(12, 15, 9 )
                .attr({
                  "fill" : "#23DBB8",
            Severity: Major
            Found in app/assets/javascripts/raphael_compare.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/raphael_compare.js on lines 194..221

            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

            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_compare.js and 1 other location - About 1 hr to fix
            app/assets/javascripts/raphael_frontend.js on lines 126..134

            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