ciudadanointeligente/partidopublico

View on GitHub

Showing 59 of 182 total issues

Method afiliados has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def afiliados
      @fechas_datos = Afiliacion.where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:fecha_datos).sort

      @regiones_datos = Afiliacion.joins(:region).where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:nombre, :region_id).sort

Severity: Minor
Found in app/controllers/comparisons_controller.rb - About 1 hr to fix

    Method partido_params has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def partido_params
              params.require(:partido).permit(:nombre, :sigla, :lema, :fecha_fundacion, :texto, :logo, :front_logo,
                                                        sedes_attributes: [:id, :region, :direccion, :contacto, :_destroy],
                                                        afiliacions_attributes: [:id, :region_id, :hombres, :mujeres, :otros, :fecha_datos, :ano_nacimiento, :_destroy],
                                                        tramites_attributes: [:id, :nombre, :descripcion, :persona_id, :documento, :_destroy,
    Severity: Minor
    Found in app/controllers/partido_steps_controller.rb - About 1 hr to fix

      Method initialize_transparency_settings has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize_transparency_settings
      
            superadmins = Admin.where is_superadmin: true
            superadmins.each do |admin|
              self.admins << admin
      Severity: Minor
      Found in app/models/partido.rb - About 1 hr to fix

        Method show has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
        
            @datos_region = []
            @datos_sedes = []
            @datos_cargos = []
        Severity: Minor
        Found in app/controllers/partidos_controller.rb - About 1 hr 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

            Method afiliados has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def afiliados
                  @fechas_datos = Afiliacion.where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:fecha_datos).sort
            
                  @regiones_datos = Afiliacion.joins(:region).where(Afiliacion.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:nombre, :region_id).sort
            
            
            Severity: Minor
            Found in app/controllers/comparisons_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

            Method completed_percentage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def completed_percentage
                  total = 0
            
                  if self.nombre
                    total = total + 2
            Severity: Minor
            Found in app/models/partido.rb - 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

                Method show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def show
                
                        # @user = current_user
                        # @partido = Partido.find_by_user_id(current_user.id)
                
                
                Severity: Minor
                Found in app/controllers/partido_steps_controller.rb - About 1 hr to fix

                  Method completed_percentage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def completed_percentage
                        total = 0
                  
                        if self.nombre
                          total = total + 2
                  Severity: Minor
                  Found in app/models/partido.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

                  Method intereses_patrimonios has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def intereses_patrimonios
                      @intereses_patrimonios = []
                      tc_candidatos = @partido.tipo_cargos#.where(candidato:true)
                      tc_candidatos.each do |tc|
                        filter_by = @partido.cargos.where(tipo_cargo_id:tc)
                  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

                  Method tutorial_progress_bar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def tutorial_progress_bar
                        content_tag(:section, class: "content") do
                          content_tag(:div, class: "navigator") do
                            content_tag(:ol, class: "steps_list") do
                              wizard_steps.collect do |every_step|
                  Severity: Minor
                  Found in app/helpers/partido_steps_helper.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 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

                    Method ingresos_ordianrios has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def ingresos_ordianrios
                          @datos = []
                    
                          @fechas_datos = IngresoOrdinario.where(IngresoOrdinario.arel_table[:partido_id].in(@partido_ids)).uniq.pluck(:fecha_datos).sort
                    
                    
                    Severity: Minor
                    Found in app/controllers/comparisons_controller.rb - About 1 hr to fix

                      Method show has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def show
                      
                              # @user = current_user
                              # @partido = Partido.find_by_user_id(current_user.id)
                      
                      
                      Severity: Minor
                      Found in app/controllers/partido_steps_controller.rb - About 55 mins 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 a Cognitive Complexity of 8 (exceeds 5 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: Minor
                      Found in app/assets/javascripts/angular/angular_app.js - About 45 mins 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 sedesController has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function sedesController($scope,$http,$location,$aside,$attrs){
                        $scope.sedes = [];
                        $scope.partido_id = $location.path().split("/")[2];
                        $scope.pageSize = 5;
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/angular/angular_app.js - About 45 mins 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 cargosController has a Cognitive Complexity of 8 (exceeds 5 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: Minor
                      Found in app/assets/javascripts/angular/angular_app.js - About 45 mins 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 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

                        Function personasController has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function personasController($scope,$http,$location,$aside,$attrs){
                        Severity: Minor
                        Found in app/assets/javascripts/angular/angular_app.js - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language