Showing 70 of 131 total issues
Avoid deeply nested control flow statements. Open
for idade in l_idades:
l_refeicoes = list(cardapios_dia[idade].keys())
for refeicao in l_refeicoes:
cardapios_dia[idade][refeicao] = []
Function dowload_special_unit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dowload_special_unit():
if request.method == 'POST':
try:
ue_id = request.form['unit_special']
- 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 get_cardapios_iguais
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_cardapios_iguais():
url = api + '/editor/cardapios?status=PENDENTE&status=SALVO'
r = requests.get(url)
refeicoes = r.json()
- 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 post_cardapio_add_merendas
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def post_cardapio_add_merendas():
FILE = './tmp/Escolas x Tipo Refeição_Texto'
with open(FILE, 'r', encoding="ISO-8859-1") as f:
refeicao_escola = {}
- 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 deletados
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def deletados():
if request.method == "GET":
deletados = get_deletados()
deletados = sort_array_date_br(deletados)
deletados_unicos = []
- 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 _key in _keys:
if cardapio[_key] != quebra[_key]:
_flag = False
Function get_quebras_escolas
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_quebras_escolas():
escolas = get_escolas()
mapa_base = collections.defaultdict(list)
for escola in escolas:
agrupamento = str(escola['agrupamento'])
- 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 item is not None and item.text is not None:
fullName += item.text
Avoid deeply nested control flow statements. Open
if txt_dcr_unidade in cardapio_dict[txt_tip_atendimento].keys():
if cod_agrupamento in cardapio_dict[txt_tip_atendimento][txt_dcr_unidade].keys():
if txt_faixa_etaria in cardapio_dict[txt_tip_atendimento][txt_dcr_unidade][cod_agrupamento].keys():
if data_merenda in cardapio_dict[txt_tip_atendimento][txt_dcr_unidade][cod_agrupamento][txt_faixa_etaria].keys():
cardapio_dict[txt_tip_atendimento][txt_dcr_unidade][cod_agrupamento][txt_faixa_etaria][data_merenda][txt_tipo_refeicao] = ', '.join(lista)
Avoid deeply nested control flow statements. Open
for refeicao in l_refeicoes:
alimentos = ', '.join(doc[r'cardapio'][refeicao])
if doc[r'idade'] in cardapios_dia:
if refeicao in cardapios_dia[doc[r'idade']]:
cardapios_dia[doc[r'idade']][refeicao].append(alimentos)
Function _criar_faixa_etaria_categoria_planilha
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _criar_faixa_etaria_categoria_planilha(self, aba_planilha, coluna_final, coluna_inicial_categoria,
Avoid deeply nested control flow statements. Open
for refeicao in escola['historico']['refeicoes']:
if refeicao in dic_refeicoes.keys():
refeicao_aux.append(dic_refeicoes[refeicao])
else:
refeicao_aux.append(refeicao)
Function titulos
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def titulos(n_faixas, n_refeicoes, escola, gestao, dt_publicacao, pl):
Function _escrever_titulos_planilha
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _escrever_titulos_planilha(self, aba_planilha, data_fim_formatada, data_inicio_formatada, titulo_polo,
Function create
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create(unidade, dta_criacao, dta_ini, dta_fim, id_escolas):
Function set_unidade
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_unidade(id_unidade, data_criacao=None, data_ini=None, data_fim=None, id_escolas=[]):
Function get_cardapios_iguais
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_cardapios_iguais():
url = api + '/cardapios?status=PENDENTE&status=SALVO'
r = requests.get(url)
refeicoes = r.json()
- 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 save_dia
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def save_dia(sv_cardapios_dia, sv_lin, sv_data_ant, sv_num_faixas, sv_num_refeicoes, sv_tipo_escola, sv_tipo_gestao,
sv_dta_pub, sv_wb, sv_ws, sv_template, sv_cabecalho):
# ..Titulos e formatação
sv_ws.cell(row=1, column=2).value = sv_cabecalho
titulos(sv_num_faixas, sv_num_refeicoes, sv_tipo_escola, sv_tipo_gestao, sv_dta_pub, sv_ws)
- 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 get_escolas
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_escolas(params=None, limit=None):
url = api + '/v2/editor/escolas'
if params:
extra = "?" + "&".join([("{}={}".format(p[0], p[1])) for p in params.items()])
url += extra
- 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 filtrar_cardapios
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filtrar_cardapios(params_dict):
cardapio_aux = []
url = api + '/editor/cardapios?data_inicial={}&data_final={}'.format(params_dict['data_inicial'], params_dict['data_final'])
# filtro de tipo de unidade e tipo de atendimento.
if params_dict['tipo_unidade'] != 'TODOS':
- 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"