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())
Avoid deeply nested control flow statements. Open
if not len(partido):
partido = "SEM PARTIDO"
if partido == "S":
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())
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"
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
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, coordenadas_parlamentares, parlamentares, partidos,
Function criar_chefe_executivo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def criar_chefe_executivo(self, nome,
Function _energia
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _energia(self, dados_fixos, dados_meus, por_partido,
Function _cria_dicionario_dados
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _cria_dicionario_dados(self, numero_proposicao,
Function guarantee_existence_of_proposition
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def guarantee_existence_of_proposition(self,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, casa_legislativa, periodicidade,
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 _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
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 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
Avoid too many return
statements within this function. Open
return models.ABSTENCAO
Avoid too many return
statements within this function. Open
return models.ABSTENCAO