RadarParlamentar-MES2017-1/radar

View on GitHub

Showing 117 of 377 total issues

Avoid deeply nested control flow statements.
Open

                if ano.find("e") == -1:
                    anos2.append(ano)
                else:
                    ano1, e, ano2 = ano.partition("e")
                    anos2.append(ano1.strip())
Severity: Major
Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                    if not len(partido):
                        partido = "SEM PARTIDO"
                    if partido == "S":
    Severity: Major
    Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                      if ano.find("e") == -1:
                          anos2.append(ano)
                      else:
                          ano1, e, ano2 = ano.partition("e")
                          anos2.append(ano1.strip())
      Severity: Major
      Found in radar_parlamentar/importadores/camara_genero/num_genero_legis.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                        if not nums:
                            nums = {"M": 0, "F": 0}
                            legis_partidos[partido] = nums
                        nums[genero] = nums.get(genero, 0) + 1

          Avoid deeply nested control flow statements.
          Open

                          if partido == "S":
                              partido = "SEM PARTIDO"
          
          
          Severity: Major
          Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if not nums:
                                nums = {"M": 0, "F": 0}
                                legis_partidos[legislatura] = nums
                            nums[genero] = nums.get(genero, 0) + 1
            Severity: Major
            Found in radar_parlamentar/importadores/camara_genero/genero_historia_partidos.py - About 45 mins to fix

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

                  def __init__(self, coordenadas_parlamentares, parlamentares, partidos,
              Severity: Minor
              Found in radar_parlamentar/analises/analise.py - About 35 mins to fix

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

                    def criar_chefe_executivo(self, nome,
                Severity: Minor
                Found in radar_parlamentar/importadores/chefes_executivos.py - About 35 mins to fix

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

                      def _energia(self, dados_fixos, dados_meus, por_partido,
                  Severity: Minor
                  Found in radar_parlamentar/analises/analise.py - About 35 mins to fix

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

                        def _cria_dicionario_dados(self, numero_proposicao,
                    Severity: Minor
                    Found in radar_parlamentar/importadores/conv.py - About 35 mins to fix

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

                          def guarantee_existence_of_proposition(self,
                      Severity: Minor
                      Found in radar_parlamentar/importadores/cmsp.py - About 35 mins to fix

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

                            def __init__(self, casa_legislativa, periodicidade,
                        Severity: Minor
                        Found in radar_parlamentar/modelagem/utils.py - About 35 mins to fix

                          Function main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def main(lista_casas_legislativas):
                          
                              for casa_legislativa in lista_casas_legislativas:
                          
                                  if casa_legislativa == 'conv':
                          Severity: Minor
                          Found in radar_parlamentar/importadores/importador.py - About 35 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 _montar_url_consulta_camara has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _montar_url_consulta_camara(self, base_url, url_params, **kwargs):
                                  built_url = base_url
                          
                                  for par in list(kwargs.keys()):
                                      if isinstance(kwargs[par], str):
                          Severity: Minor
                          Found in radar_parlamentar/importadores/cdep.py - About 35 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 insere_genero_parlamentares_camara has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def insere_genero_parlamentares_camara():
                              URL_DADOS_CDEP = 'http://www.camara.leg.br/internet/deputado/'
                              ARQ_DADOS_CDEP = 'DeputadosXML_52a55.zip'
                              xml = abrir_xml_zipado(url=URL_DADOS_CDEP + ARQ_DADOS_CDEP)
                          
                          
                          Severity: Minor
                          Found in radar_parlamentar/importadores/cdep_genero.py - About 35 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 _dict_partido has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _dict_partido(self, partido):
                                  dict_partido = {"nome": partido.nome,
                                                  "numero": partido.numero,
                                                  "cor": partido.cor}
                                  dict_partido["t"] = []
                          Severity: Minor
                          Found in radar_parlamentar/analises/grafico.py - About 35 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 _voto_senado_to_model has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _voto_senado_to_model(self, voto):
                                  """Interpreta voto como tá no XML e responde em adequação a modelagem
                                  em models.py"""
                          
                                  DESCULPAS = ['MIS', 'MERC', 'P-NRV', 'REP',
                          Severity: Minor
                          Found in radar_parlamentar/importadores/sen.py - About 35 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 proposicoes_indexadas has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def proposicoes_indexadas(lista_proposicoes):
                              indexados = []
                              for proposicao in lista_proposicoes:
                                  if proposicao['txtIndexacao'] and proposicao['txtSiglaPartido']:
                                      if proposicao['txtSiglaPartido'].strip() in LISTA_BASE_PARTIDOS:
                          Severity: Minor
                          Found in radar_parlamentar/importadores/camara_genero.py - About 35 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

                          Avoid too many return statements within this function.
                          Open

                                      return models.ABSTENCAO
                          Severity: Major
                          Found in radar_parlamentar/importadores/sen.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return models.ABSTENCAO
                            Severity: Major
                            Found in radar_parlamentar/importadores/sen.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language