prefeiturasp/SME-PratoAberto-Editor

View on GitHub

Showing 131 of 131 total issues

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':
Severity: Minor
Found in app.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 set_cardapio has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def set_cardapio(cardapios, doc_cardapio, doc_idade):
    l_refeicoes = list(doc_cardapio.keys())
    for refeicao in l_refeicoes:
        alimentos = ', '.join(doc_cardapio[refeicao])
        if doc_idade in cardapios:
Severity: Minor
Found in helpers/download_special_unit_menu.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 save_dia has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def save_dia(wb, ws, lin, data_ant, cardapios, xls_file):
    numero_dia = datetime.weekday(datetime(int(data_ant[:4]), int(data_ant[4:][:2]), int(data_ant[6:])))
    nome_dia = dias_semana[numero_dia]
    dia = nome_dia + ' ' + data_ant[6:] + '/' + meses[int(data_ant[4:][:2]) - 1][:3]
    ws.cell(row=lin, column=1).value = dia
Severity: Minor
Found in helpers/download_special_unit_menu.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_grupo_publicacoes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_grupo_publicacoes(status, data_inicial, data_final):
    url = api + '/editor/cardapios?status=' + status + '&data_inicial=' + data_inicial + '&data_final=' + data_final
    r = requests.get(url)
    refeicoes = r.json()

Severity: Minor
Found in app.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 visualizador has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def visualizador():
    args = request.args

    ##### Optimation referrer #####
    if args.get('status') == 'PUBLICADO':
Severity: Minor
Found in app.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 open_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def open_csv():
    path = './tmp'
    file = 'Cardapios Novos.csv'

    cardapio = []
Severity: Minor
Found in analises.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_categorias_by_faixa_etaria_dict has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_categorias_by_faixa_etaria_dict(self, semana, faixa_etarias):
        categoria_dict = {}
        faixas_etarias_ordenada = sorted(faixa_etarias, key=lambda k: k)
        for faixa in faixas_etarias_ordenada:
            categoria_dict[faixa] = []
Severity: Minor
Found in helpers/gerador_excel_cardapio_ue.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_cardapios has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_cardapios():
    url = api + '/editor/cardapios?status=PENDENTE&status=SALVO&status=PUBLICADO'
    r = requests.get(url)
    refeicoes = r.json()

Severity: Minor
Found in analises.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 connect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def connect(colecao=None):
    client = MongoClient(os.environ.get('MONGO_HOST'))
    db = client.pratoaberto

    try:
Severity: Minor
Found in ue_mongodb.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_deletados has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_deletados():
    url = api + '/editor/cardapios?status=DELETADO'
    r = requests.get(url)
    refeicoes = r.json()

Severity: Minor
Found in app.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 sort_array_date_br has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def sort_array_date_br(data_array, opt=1):
    """
    recebe um array, transforma a coluna 4 e 5 para datetime
    ordena
    passa as colunas pra formato string br
Severity: Minor
Found in utils.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