Gustavosdo/summum

View on GitHub

Showing 59 of 438 total issues

Function gera_venda has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

    def gera_venda(self):
        print('Etapa 2 - Início do procedimento de inserção de Vendas.')
        
        lista_clientes = Cliente.objects.filter(status=1)
        lista_formas_pagamento = FormaPagamento.objects.filter(status=1)
Severity: Minor
Found in estagio/fixtures/py/insert_2_Venda.py - About 1 day 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 gera_compra has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def gera_compra(self):
        print('Etapa 1 - Início do procedimento de inserção de Compras.')
        
        lista_fornecedores = Fornecedor.objects.filter(status=1)
        lista_formas_pagamento = FormaPagamento.objects.filter(status=1)
Severity: Minor
Found in estagio/fixtures/py/insert_1_Compra.py - About 6 hrs 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 clean has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def clean(self):

        # Condição para validar os itens de compra somente se o objeto não existir, ou se este for um pedido ainda não confirmado, ou registro não está cancelado
        # print(self.instance.pk and (self.instance.status or self.instance.pedido == 'N' or (self.instance.pedido == 'S' and self.instance.status_pedido)))
        if self.instance.pk and (self.instance.status or self.instance.pedido == 'N' or (self.instance.pedido == 'S' and self.instance.status_pedido)):
Severity: Minor
Found in estagio/venda/forms.py - About 4 hrs 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 gera_recebimento has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def gera_recebimento(self):
        print('Etapa 6 - Início do procedimento de inserção de Recebimentos.')

        if caixa_aberto():

Severity: Minor
Found in estagio/fixtures/py/insert_6_Recebimento.py - About 3 hrs 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

Consider simplifying this complex logical expression.
Open

        if obj is None:
            self.fieldsets[0][1]['fields'] = tuple(x for x in self.fieldsets[0][1]['fields'] if (x!='compra_associada' and x!='id' and x!='status' and x!='fornecedor_associado' and x!='forma_pagamento_associada' and x!='grupo_encargo_associado'))
            self.fieldsets[1][1]['fields'] = tuple(x for x in self.fieldsets[1][1]['fields'] if (x!='link_pagamentos_conta' and x!='valor_total_cobrado' and x!='valor_total_a_pagar' and x!='valor_total_encargos' and x!='valor_total_descontos' and x!='valor_total_juros' and x!='valor_total_multa'))
        
        else:
Severity: Critical
Found in estagio/contas_pagar/admin.py - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if obj is None:
                self.fieldsets[0][1]['fields'] = tuple(x for x in self.fieldsets[0][1]['fields'] if (x!='venda_associada' and x!='id' and x!='status' and x!='cliente_associado' and x!='forma_pagamento_associada' and x!='grupo_encargo_associado'))
                self.fieldsets[1][1]['fields'] = tuple(x for x in self.fieldsets[1][1]['fields'] if (x!='link_recebimentos_conta' and x!='valor_total_cobrado' and x!='valor_total_a_receber' and x!='valor_total_encargos' and x!='valor_total_descontos' and x!='valor_total_juros' and x!='valor_total_multa'))
            
            else:
    Severity: Critical
    Found in estagio/contas_receber/admin.py - About 3 hrs to fix

      Function convert_tag has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def convert_tag(tag_received, validate_tags=False):
          """ 
          .. Note:: Inspiration
          http://effbot.org/zone/django-simple-template.htm 
          """
      Severity: Minor
      Found in estagio/text_tag/utils.py - About 3 hrs 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

      File settings.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #-*- coding: UTF-8 -*-
      """
      Django settings for estagio project.
      
      For more information on this file, see
      Severity: Minor
      Found in estagio/estagio/settings.py - About 3 hrs to fix

        Function valida_documento_csv has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        def valida_documento_csv(document):
            """
                Checa se formato de arquivo csv é válido.
                Os campos obrigatórios que devem conter o arquivo são especificados no dicionário HEADERS.
        
        
        Severity: Minor
        Found in estagio/notificacao/validators.py - About 3 hrs 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

        File conta_receber.py has 295 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        #-*- coding: UTF-8 -*-
        from django.db import models
        from django.core.exceptions import ValidationError
        from django.db.models import Sum
        from django.core.urlresolvers import reverse
        Severity: Minor
        Found in estagio/contas_receber/models/conta_receber.py - About 3 hrs to fix

          Function gera_pagamento has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def gera_pagamento(self):
                  print('Etapa 5 - Início do procedimento de inserção de Pagamentos.')
          
                  if caixa_aberto():
          
          
          Severity: Minor
          Found in estagio/fixtures/py/insert_5_Pagamento.py - About 2 hrs 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

          File conta_pagar.py has 286 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #-*- coding: UTF-8 -*-
          from django.db import models
          from django.core.exceptions import ValidationError
          from django.db.models import Sum
          from django.core.urlresolvers import reverse
          Severity: Minor
          Found in estagio/contas_pagar/models/conta_pagar.py - About 2 hrs to fix

            ContasReceber has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ContasReceber(models.Model):
                u""" 
                Classe ContasReceber. 
            
                Criada em 22/09/2014. 
            Severity: Minor
            Found in estagio/contas_receber/models/conta_receber.py - About 2 hrs to fix

              Function save has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def save(self, *args, **kwargs):
                      """
                      Método que trata a geração e cálculo da parte financeira de uma venda.
                      """
                      
              Severity: Minor
              Found in estagio/venda/models.py - About 2 hrs 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

              File reverse_engineer.py has 252 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # This is an auto-generated Django model module.
              # You'll have to do the following manually to clean this up:
              #   * Rearrange models' order
              #   * Make sure each model has one field with primary_key=True
              #   * Remove `managed = False` lines for those models you wish to give write DB access
              Severity: Minor
              Found in estagio/docs/reverse_engineer.py - About 2 hrs to fix

                Function cliente_detalhe_financeiro has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def cliente_detalhe_financeiro(request, id_cliente):
                    # Busca todos os dados do cliente
                    cliente = Cliente.objects.get(pk=id_cliente)
                    contas_cliente = ContasReceber.objects.filter(cliente=id_cliente).values_list('pk')
                    parcelas_cliente = ParcelasContasReceber.objects.filter(contas_receber__cliente=id_cliente).values_list('pk')
                Severity: Minor
                Found in estagio/pessoal/views.py - About 1 hr to fix

                  Function save has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def save(self, *args, **kwargs):
                          """
                          Método que trata a geração e cálculo da parte financeira de uma compra.
                          """
                  
                  
                  Severity: Minor
                  Found in estagio/compra/models.py - About 1 hr 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_context_data has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def get_context_data(self, **kwargs):
                          context = super(DashboardMainView, self).get_context_data(**kwargs)
                  
                          parametrizacao = Parametrizacao.objects.values_list('qtde_minima_produtos_em_estoque', 'evento_calendario')[0]
                          evento_calendario = parametrizacao[1]
                  Severity: Minor
                  Found in estagio/dashboard/views.py - About 1 hr to fix

                    Function gera_contas_receber has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def gera_contas_receber(self):
                            print('Etapa 4 - Início do procedimento de inserção de Contas a Receber.')
                            
                            lista_clientes = Cliente.objects.filter(status=1)
                            lista_formas_pagamento = FormaPagamento.objects.filter(status=1)
                    Severity: Minor
                    Found in estagio/fixtures/py/insert_4_ContasReceber.py - About 1 hr 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_form has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_form(self, request, obj=None, **kwargs):
                            self.suit_form_tabs = (
                                ('geral', _(u"Geral")),
                                ('info_adicionais', _(u"Informações adicionais"))
                            )
                    Severity: Minor
                    Found in estagio/compra/admin.py - About 1 hr 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