RadarParlamentar-MES2017-1/radar

View on GitHub

Showing 117 of 377 total issues

Avoid too many return statements within this function.
Open

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

    Avoid too many return statements within this function.
    Open

                return 0
    Severity: Major
    Found in radar_parlamentar/exportadores/exportador_csv_r.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

        Function lista_proposicoes_de_mulheres has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def lista_proposicoes_de_mulheres():
            camaraws = Camaraws()
            prop_finder = ProposicoesFinder()
            importador = ImportadorCamara([''])
            importador.camara_dos_deputados = importador._gera_casa_legislativa()
        Severity: Minor
        Found in radar_parlamentar/importadores/cdep.py - About 25 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 enviar_para_elasticsearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def enviar_para_elasticsearch(list_json, nome_indice):
            es = conectar_em_elastic_search()
            for item in list_json:
                for key in list(item.keys()):
                    if item[key] == "":
        Severity: Minor
        Found in radar_parlamentar/importadores/importador_elasticsearch.py - About 25 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 plenaria has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def plenaria(request,
                     nome_curto_casa_legislativa=None,
                     identificador_proposicao=None):
            """identificador_proposicao: 'PL-123-2015'"""
        
        
        Severity: Minor
        Found in radar_parlamentar/plenaria/views.py - About 25 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 analisa_partidos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def analisa_partidos(self):
                """Gera as seguintes saídas:
                    self.coordenadas_partido # partido => [x,y]
                    self.tamanhos_partidos # partido => int
                    self.parlamentares_por_partido # partido => parlamentares
        Severity: Minor
        Found in radar_parlamentar/analises/analise.py - About 25 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 jsonMatrix_gera_links_partidos_termos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def jsonMatrix_gera_links_partidos_termos():
            global matrix
            matrix['links'] = []
            for p in range(len(matrix['partidos'])):
                partidoNome = matrix['partidos'][p]['name']
        Severity: Minor
        Found in radar_parlamentar/importadores/camara_genero.py - About 25 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 retrieve_votacoes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def retrieve_votacoes(self):
                try:
                    casa = models.CasaLegislativa.objects.get(nome_curto='cdep')
                except:
                    casa = None
        Severity: Minor
        Found in radar_parlamentar/exportadores/exportador_csv_r.py - About 25 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 partidos_das_proposicoes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def partidos_das_proposicoes(lista_proposicoes):
            for proposicao in lista_proposicoes:
                if proposicao['txtSiglaPartido']:
                    partido = proposicao['txtSiglaPartido'].strip()
                    if partido not in PARTIDOS:
        Severity: Minor
        Found in radar_parlamentar/importadores/camara_genero.py - About 25 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 _scale has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _scale(self, coords):
                scaled = {}
                for key, coord in list(coords.items()):
                    x = coord[0]
                    try:
        Severity: Minor
        Found in radar_parlamentar/analises/grafico.py - About 25 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 votos_from_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def votos_from_tree(self, vot_tree, votacao):
                """Extrai lista de votos do XML da votação e as salva no banco de dados
        
                Argumentos:
                   vot_tree -- etree dos votos
        Severity: Minor
        Found in radar_parlamentar/importadores/cmsp.py - About 25 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 parseia_indexacoes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def parseia_indexacoes(indexacao):
            indexacao1 = [termo.strip()
                          for termo in indexacao.replace('\n', '').replace('.', '').
                          replace('_', '').split(',')]
            indexacao2 = []
        Severity: Minor
        Found in radar_parlamentar/importadores/camara_genero.py - About 25 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 get_casas_legislativas_com_genero has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_casas_legislativas_com_genero():
        
                casas_legislativas = []
        
                for casa in CasaLegislativa.objects.all():
        Severity: Minor
        Found in radar_parlamentar/analises/genero.py - About 25 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 transform_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def transform_data(self):
                self.csv_rows.append(LABELS)
                for votacao in self.votacoes:
                    votos = votacao.votos()
                    for voto in votos:
        Severity: Minor
        Found in radar_parlamentar/exportadores/exportador_csv_r.py - About 25 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 _votacao_from_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _votacao_from_xml(self, votacao_xml, prop):
                """votacao_xml -- XML representando votação (objeto etree)
                   prop -- objeto do tipo Proposicao
                """
                descricao = 'Resumo: [%s]. ObjVotacao: [%s]' % (
        Severity: Minor
        Found in radar_parlamentar/importadores/cdep.py - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def voto(self, opcao):
                if opcao == models.SIM:
                    return 1
                elif opcao == models.NAO:
                    return -1
        Severity: Minor
        Found in radar_parlamentar/exportadores/exportador_csv_r.py - About 25 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

        Severity
        Category
        Status
        Source
        Language