Gustavosdo/summum

View on GitHub
estagio/contas_receber/models/conta_receber.py

Summary

Maintainability
F
2 wks
Test Coverage

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

    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

      Cyclomatic complexity is too high in method prazo_primeira_parcela. (7)
      Open

          def prazo_primeira_parcela(self, data, num_parcela):
              """
              Método que define a data de vencimento da primeira parcela baseado na parametrização da forma de pagamento.
      
              Parâmetros passados (data_da_venda, número_da_parcela) 

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

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

          def save(self, *args, **kwargs):
              """
              Método que trata a geração e cálculo de contas à receber.
              """
      
      
      Severity: Minor
      Found in estagio/contas_receber/models/conta_receber.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 prazo_entre_parcelas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def prazo_entre_parcelas(self, data):
              """
              Método que define o prazo entre data baseado na parametrização da forma de pagamento.
              Permite trabalhar com data com prazos semanais e mensais.
      
      
      Severity: Minor
      Found in estagio/contas_receber/models/conta_receber.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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def save(self, *args, **kwargs):
              """
              Método que trata a geração e cálculo de contas à receber.
              """
      
      
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 2 days to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 326..365

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 245.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def forma_pagamento_associada(self):
              choices_tp = self.forma_pagamento._meta.get_field('tipo_prazo').flatchoices
              tp = dict(choices_tp).get(self.forma_pagamento.tipo_prazo)
              choices_tp = self.forma_pagamento._meta.get_field('tipo_carencia').flatchoices
              tc = dict(choices_tp).get(self.forma_pagamento.tipo_carencia)
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 day to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 115..132

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 175.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def prazo_primeira_parcela(self, data, num_parcela):
              """
              Método que define a data de vencimento da primeira parcela baseado na parametrização da forma de pagamento.
      
              Parâmetros passados (data_da_venda, número_da_parcela) 
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 day to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 250..270

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 141.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def valor_total_juros(self):
      
              valor_total_juros = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 day to fix
      estagio/contas_receber/models/conta_receber.py on lines 177..185

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 137.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def valor_total_multa(self):
      
              valor_total_multa = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 day to fix
      estagio/contas_receber/models/conta_receber.py on lines 165..173

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 137.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def grupo_encargo_associado(self):
              choices_tj = self.grupo_encargo._meta.get_field('tipo_juros').flatchoices
              tj = dict(choices_tj).get(self.grupo_encargo.tipo_juros)
              if self.grupo_encargo:
                  url = pode_ver_link(self.usuario_sessao, 'parametros_financeiros', 'grupoencargo', self.grupo_encargo.pk)
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 day to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 138..151

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_descontos(self):
      
              valor_descontos = 0
              quant_parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).count()
              for i in range(quant_parcelas):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 7 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 191..198
      estagio/contas_pagar/models/conta_pagar.py on lines 202..209
      estagio/contas_pagar/models/conta_pagar.py on lines 213..220
      estagio/contas_pagar/models/conta_pagar.py on lines 239..246

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 120.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def valor_parcela(self, num_parcela, total):
              """
              Método que calcula os valores das mensalidades para que na divisão das parcelas, não fique restando valores decimais nos centavos gerados.
              Caso ocorra, a última parcela da venda recebe o valor restante.
      
      
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 6 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 294..310

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 109.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_encargos_pagos(self):
      
              valor_encargos = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 6 hrs to fix
      estagio/contas_receber/models/conta_receber.py on lines 189..195
      estagio/contas_receber/models/conta_receber.py on lines 210..216
      estagio/contas_receber/models/conta_receber.py on lines 231..237
      estagio/contas_receber/models/conta_receber.py on lines 256..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_cobrado(self):
      
              valor_cobrado = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 6 hrs to fix
      estagio/contas_receber/models/conta_receber.py on lines 189..195
      estagio/contas_receber/models/conta_receber.py on lines 200..206
      estagio/contas_receber/models/conta_receber.py on lines 210..216
      estagio/contas_receber/models/conta_receber.py on lines 256..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_encargos(self):
      
              valor_encargos = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 6 hrs to fix
      estagio/contas_receber/models/conta_receber.py on lines 200..206
      estagio/contas_receber/models/conta_receber.py on lines 210..216
      estagio/contas_receber/models/conta_receber.py on lines 231..237
      estagio/contas_receber/models/conta_receber.py on lines 256..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_a_receber(self):
      
              valor_a_receber = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 6 hrs to fix
      estagio/contas_receber/models/conta_receber.py on lines 189..195
      estagio/contas_receber/models/conta_receber.py on lines 200..206
      estagio/contas_receber/models/conta_receber.py on lines 210..216
      estagio/contas_receber/models/conta_receber.py on lines 231..237

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

          def valor_total_encargos_a_pagar(self):
      
              valor_encargos = 0
              parcelas = ParcelasContasReceber.objects.filter(contas_receber=self.pk).values_list('pk')
              for i in range(len(parcelas)):
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 4 other locations - About 6 hrs to fix
      estagio/contas_receber/models/conta_receber.py on lines 189..195
      estagio/contas_receber/models/conta_receber.py on lines 200..206
      estagio/contas_receber/models/conta_receber.py on lines 231..237
      estagio/contas_receber/models/conta_receber.py on lines 256..262

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def prazo_entre_parcelas(self, data):
              """
              Método que define o prazo entre data baseado na parametrização da forma de pagamento.
              Permite trabalhar com data com prazos semanais e mensais.
      
      
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 6 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 273..291

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 103.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def clean(self):
              """ 
              Bloqueia o registro de uma conta a receber quando não há caixa aberto.
              """
              if not caixa_aberto() and not self.pk:
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 3 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 77..85

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def valor_total_recebido(self):
      
              valor_recebido = Recebimento.objects.filter(parcelas_contas_receber__contas_receber=self.pk).aggregate(Sum('valor'))
              valor_recebido = valor_recebido["valor__sum"]
              return valor_recebido or Decimal(0.00).quantize(Decimal("0.00"))
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 3 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 224..228

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 66.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def venda_associada(self):
              if self.vendas:
                  try:
                      url = pode_ver_link(self.usuario_sessao, 'venda', 'venda', self.vendas.pk)
                  except:
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 2 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 92..99

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def link_recebimentos_conta(self):
              url = reverse('admin:app_list', kwargs={'app_label': 'contas_receber'})
              return u"<a href='%(url)srecebimento/recebimentos_conta/%(pk)s' class='modal-rel-recebimentos modal-main-custom'>%(valor)s<span class='icon-share icon-alpha5 hint--bottom hint--bounce' style='vertical-align: text-bottom; margin-left: 10px;' rel='tooltip' data-hint='%(desc)s %(pk)s'></span></a>" % {'url': url, 'pk': self.pk, 'valor': self.valor_total_recebido(), 'desc': _(u"Visualize todos os recebimentos da conta")}
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 2 hrs to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 232..234

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 52.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def cliente_associado(self):
              if self.cliente:
                  url = pode_ver_link(self.usuario_sessao, 'pessoal', 'cliente', self.cliente.pk)
                  return u"<a href='%s'>%s</a>" % (url, self.cliente)
              return '-'
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 hr to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 105..109

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          def pagamento_primeira_parcela(self, num_parcela):
              """
              Método que define como pago a primeira parcela de uma conta, caso a carência parametrizada na forma de pagamento seja 0(zero).
      
              Parâmetros passados (número_da_parcela)
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 1 hr to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 313..323

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 42.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          def formata_descricao(self):
              if self.descricao:
                  return u"<p title='%s'>%s...</p>" % (self.descricao, self.descricao[:35])
              return '-'
      Severity: Minor
      Found in estagio/contas_receber/models/conta_receber.py and 1 other location - About 55 mins to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 157..160

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 37.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 12 locations. Consider refactoring.
      Open

          class Meta(object):
              verbose_name = _(u"Conta a Receber")
              verbose_name_plural = _(u"Contas a Receber")
              permissions = ((u"pode_exportar_contasreceber", _(u"Exportar Contas a Receber")),)
      Severity: Major
      Found in estagio/contas_receber/models/conta_receber.py and 11 other locations - About 50 mins to fix
      estagio/contas_pagar/models/conta_pagar.py on lines 71..74
      estagio/contas_pagar/models/parcela_conta_pagar.py on lines 33..36
      estagio/contas_receber/models/parcela_conta_receber.py on lines 33..36
      estagio/caixa/models.py on lines 160..163
      estagio/compra/models.py on lines 36..39
      estagio/pessoal/models.py on lines 105..108
      estagio/pessoal/models.py on lines 159..162
      estagio/pessoal/models.py on lines 186..189
      estagio/pessoal/models.py on lines 202..205
      estagio/venda/models.py on lines 43..46
      estagio/venda/models.py on lines 231..234

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 36.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status