Showing 117 of 377 total issues
Function agrupa_palavras
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def agrupa_palavras(self, genero, id_casa_legislativa):
for parlamentar in Parlamentar.objects.filter(
genero=genero, casa_legislativa_id=id_casa_legislativa):
for proposicao in Proposicao.objects.filter(
autor_principal=parlamentar.nome):
- 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 diagonal
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
d3.svg.diagonal = function() {
var source = d3_svg_chordSource,
target = d3_svg_chordTarget,
projection = d3_svg_diagonalProjection;
Function d3_behavior_zoomTo
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function d3_behavior_zoomTo(z, x0, x1) {
z = d3_behavior_zoomExtentClamp(z, 2);
var j = Math.pow(2, d3_behavior_zoomXyz[2]),
k = Math.pow(2, z),
K = Math.pow(2, (d3_behavior_zoomXyz[2] = z) - x1[2]),
Function d3_svg_brushMove
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function d3_svg_brushMove() {
if (d3_svg_brushOffset) {
var mouse = d3.svg.mouse(d3_svg_brushTarget),
g = d3.select(d3_svg_brushTarget);
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 not legis_partidos:
legis_partidos = {}
historia[partido] = legis_partidos
nums = legis_partidos.get(legislatura, {})
Avoid deeply nested control flow statements. Open
for (j = i + 1; j < n; ++j) q[j].i--;
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())
Function __str__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self):
data_string = ''
# data_string = str(self.ini.year) # sempre começa com o ano
delta = self.fim - self.ini
if delta.days < 35: # período é de um mê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
Avoid deeply nested control flow statements. Open
if partido == "S":
partido = "SEM PARTIDO"
Avoid deeply nested control flow statements. Open
for (j = i + 1; j < n; ++j) q[j].i--;
Function get_chefe_periodo
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_chefe_periodo(ano_inicio, ano_fim, chefes_executivo):
chefes = []
for chefe in chefes_executivo:
ano_inicio_valido = (ano_inicio >= chefe.mandato_ano_inicio) and (
ano_inicio <= chefe.mandato_ano_fim)
- 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 deeply nested control flow statements. Open
if partido not in lista_partidos:
lista_partidos.append(partido)
Function _dict_parlamentar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _dict_parlamentar(self, parlamentar):
leg_id = parlamentar.id
nome = parlamentar.nome
localidade = parlamentar.localidade
dict_parlamentar = {"nome": nome,
- 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 deeply nested control flow statements. Open
for (j = i + 1; j < n; ++j) q[j].i -= 2;
Avoid deeply nested control flow statements. Open
if not len(partido):
partido = "SEM PARTIDO"
if partido == "S":
Function _preenche_matrizes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _preenche_matrizes(self, votacao, iv):
ip = -1 # indice parlamentares
for parlamentar in self.parlamentares:
ip += 1
self.partido_do_parlamentar.append(parlamentar.partido.nome)
- 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 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
Avoid deeply nested control flow statements. Open
if not legis_partidos:
legis_partidos = {}
historia[legislatura] = legis_partidos
nums = legis_partidos.get(partido, {})