ciudadanointeligente/partidopublico

View on GitHub

Showing 59 of 182 total issues

File angular_app.js has 737 lines of code (exceeds 250 allowed). Consider refactoring.
Open

function scroll_to_top() {
    $('html, body').animate({
        scrollTop: $('#container').offset().top
    }, 500);
}
Severity: Major
Found in app/assets/javascripts/angular/angular_app.js - About 1 day to fix

    File partidos_controller.rb has 497 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class PartidosController < ApplicationController
      before_action :authenticate_admin!, only: [:new, :edit, :create, :update, :destroy, :admin]
      before_filter :authenticate_superadmin, only: [:new, :edit, :create, :update, :destroy]
      before_action :set_partido, except: [:index, :new, :create, :admin]
      before_action :get_partidos, except: [:index, :new, :create, :admin]
    Severity: Minor
    Found in app/controllers/partidos_controller.rb - About 7 hrs to fix

      Function cargosController has 157 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function cargosController($scope,$http,$location,$aside,$attrs){
        $scope.cargos = [];
        $scope.personas = [];
        $scope.partido_id = $location.path().split("/")[2];
        $scope.pageSize = 5;
      Severity: Major
      Found in app/assets/javascripts/angular/angular_app.js - About 6 hrs to fix

        Class PartidosController has 34 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class PartidosController < ApplicationController
          before_action :authenticate_admin!, only: [:new, :edit, :create, :update, :destroy, :admin]
          before_filter :authenticate_superadmin, only: [:new, :edit, :create, :update, :destroy]
          before_action :set_partido, except: [:index, :new, :create, :admin]
          before_action :get_partidos, except: [:index, :new, :create, :admin]
        Severity: Minor
        Found in app/controllers/partidos_controller.rb - About 4 hrs to fix

          Function sedesController has 99 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function sedesController($scope,$http,$location,$aside,$attrs){
            $scope.sedes = [];
            $scope.partido_id = $location.path().split("/")[2];
            $scope.pageSize = 5;
          
          
          Severity: Major
          Found in app/assets/javascripts/angular/angular_app.js - About 3 hrs to fix

            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

              Method regiones has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def regiones
                  rangos = [[14,17],[18,24],[25,29],[30,34],[35,39],[40,44],[45,49],[50,54],[55,59],[60,64],[65,69],[70,100]]
                  @datos_region = []
                  @datos_nacional = []
                  @rangos_edad = []
              Severity: Major
              Found in app/controllers/partidos_controller.rb - About 3 hrs to fix

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

                  function personasController($scope,$http,$location,$aside,$attrs){
                    $scope.persona = {};
                    $scope.personas = [];
                    $scope.partido_id = $location.path().split("/")[2];
                    $scope.pageSize = 5;
                  Severity: Major
                  Found in app/assets/javascripts/angular/angular_app.js - About 3 hrs to fix

                    Method afiliados_x_edad has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def afiliados_x_edad
                          rangos = rangos_etarios
                    
                          @fechas_datos = Afiliacion.where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:fecha_datos).sort
                    
                    
                    Severity: Minor
                    Found in app/controllers/comparisons_controller.rb - About 3 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 tipoCargosController has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function tipoCargosController($scope,$http,$location,$aside,$attrs){
                      $scope.tipo_cargos = [];
                      $scope.partido_id = $location.path().split("/")[2];
                    
                      function getTipoCargosByPartido(partido_id) {
                    Severity: Major
                    Found in app/assets/javascripts/angular/angular_app.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 actividad_publicasController has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function actividad_publicasController($scope,$http,$location,$aside,$attrs){
                          $scope.actividad_publicas = [];
                          $scope.partido_id = $location.path().split("/")[2];
                        
                          var save_or_update_actividad_publica = function() {
                        Severity: Major
                        Found in app/assets/javascripts/angular/angular_app.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 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

                              Method afiliados_x_edad has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def afiliados_x_edad
                                    rangos = rangos_etarios
                              
                                    @fechas_datos = Afiliacion.where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:fecha_datos).sort
                              
                              
                              Severity: Major
                              Found in app/controllers/comparisons_controller.rb - About 2 hrs to fix

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

                                  def acuerdos_organos
                                    @acuerdos = []
                                    tipos = %w(Acta Programatico Electoral Funcionamiento\ Interno)
                                
                                    tipos.each do |t|
                                Severity: Minor
                                Found in app/controllers/partidos_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

                                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

                                  Method estructura_organica has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def estructura_organica
                                      organos_internos = @partido.organo_internos
                                      @datos = []
                                  
                                      organos_internos.each do |o|
                                  Severity: Minor
                                  Found in app/controllers/partidos_controller.rb - About 1 hr 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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language