Showing 107 of 402 total issues
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',
- Read upRead up
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 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':
- Read upRead up
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):
- Read upRead up
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)
- Read upRead up
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:
- Read upRead up
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"] = []
- Read upRead up
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
Avoid too many return
statements within this function. Open
return 0
Avoid too many return
statements within this function. Open
return models.ABSTENCAO
Avoid too many return
statements within this function. Open
return models.ABSTENCAO
Avoid too many return
statements within this function. Open
return models.ABSTENCAO
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 = []
- Read upRead up
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]' % (
- Read upRead up
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:
- Read upRead up
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 importar_votacoes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def importar_votacoes(self):
"""# Realiza a consulta a API do senado através de uma request e
retorna os arquivos XMLS referentes as votações para serem importados
pelo radar
# facilita debug"""
- Read upRead up
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'"""
casas_legislativas = []
- Read upRead up
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
- Read upRead up
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 _deputado
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _deputado(self, voto_xml):
"""Procura primeiro no cache e depois no banco; se não existir,
cria novo parlamentar"""
nome = voto_xml.get('Nome')
nome_partido = voto_xml.get('Partido')
- Read upRead up
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
- Read upRead up
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):
"""Envia o json do modelo do radar para o Elasticsearch."""
es = conectar_em_elastic_search()
for item in list_json:
for key in list(item.keys()):
- Read upRead up
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"