Trust-Code/odoo-brasil

View on GitHub

Showing 421 of 421 total issues

Consider simplifying this complex logical expression.
Open

            if bank_account.bank_id:
                acc_number_format = bank_account.bank_id.acc_number_format \
                    or '%(acc_number)s'
                args = {
                    'bra_number': bank_account.bra_number or '',
Severity: Major
Found in br_base/models/res_bank.py - About 40 mins to fix

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

        @api.onchange('city_id')
        def onchange_city_id(self):
            """ Ao alterar o campo city_id copia o nome
            do município para o campo city que é o campo nativo do módulo base
            para manter a compatibilidade entre os demais módulos que usam o
    Severity: Major
    Found in br_base/models/res_bank.py and 2 other locations - About 40 mins to fix
    br_base/models/res_company.py on lines 163..171
    br_base/models/res_partner.py on lines 156..164

    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 34.

    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 3 locations. Consider refactoring.
    Open

        @api.onchange('city_id')
        def onchange_city_id(self):
            """ Ao alterar o campo city_id copia o nome
            do município para o campo city que é o campo nativo do módulo base
            para manter a compatibilidade entre os demais módulos que usam o
    Severity: Major
    Found in br_base/models/res_company.py and 2 other locations - About 40 mins to fix
    br_base/models/res_bank.py on lines 42..50
    br_base/models/res_partner.py on lines 156..164

    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 34.

    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 3 locations. Consider refactoring.
    Open

        @api.onchange('city_id')
        def _onchange_city_id(self):
            """ Ao alterar o campo city_id copia o nome
            do município para o campo city que é o campo nativo do módulo base
            para manter a compatibilidade entre os demais módulos que usam o
    Severity: Major
    Found in br_base/models/res_partner.py and 2 other locations - About 40 mins to fix
    br_base/models/res_bank.py on lines 42..50
    br_base/models/res_company.py on lines 163..171

    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 34.

    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

        total_desconto = fields.Float(
            string='Desconto Total ( - )', readonly=True, compute='_amount_all',
            digits=dp.get_precision('Account'), store=True,
    Severity: Minor
    Found in br_purchase/models/purchase.py and 1 other location - About 40 mins to fix
    br_sale/models/sale.py on lines 48..50

    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 34.

    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

        total_desconto = fields.Float(
            string='Desconto Total ( - )', readonly=True, compute='_amount_all',
            digits=dp.get_precision('Account'), store=True,
    Severity: Minor
    Found in br_sale/models/sale.py and 1 other location - About 40 mins to fix
    br_purchase/models/purchase.py on lines 44..46

    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 34.

    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

    Function _filter_rules has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _filter_rules(self, fpos_id, type_tax, partner, product, state):
    Severity: Minor
    Found in br_account/models/account_fiscal_position.py - About 35 mins to fix

      Function values_postprocess has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def values_postprocess(self, order, mode, values, errors, error_msg):
      Severity: Minor
      Found in br_website_sale/controllers/main.py - About 35 mins to fix

        Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def create(self, cr, uid, ids, datas, context=False):
        Severity: Minor
        Found in br_nfe/reports/report.py - About 35 mins to fix

          Function _load_template has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _load_template(self, company, code_digits=None,
          Severity: Minor
          Found in br_account/models/account_tax.py - About 35 mins to fix

            Function compute_all has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def compute_all(self, price_unit, currency=None, quantity=1.0,
            Severity: Minor
            Found in br_account/models/account_tax.py - About 35 mins to fix

              Function _prepare_refund has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def _prepare_refund(self, invoice, date_invoice=None, date=None,
              Severity: Minor
              Found in br_account/models/account_invoice.py - About 35 mins to fix

                Function create has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def create(self, cr, uid, ids, datas, context=False):
                Severity: Minor
                Found in br_boleto/reports/report.py - About 35 mins to fix

                  Function _hook_validation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _hook_validation(self):
                          errors = super(InvoiceEletronic, self)._hook_validation()
                          if self.model != '65':
                              return errors
                          if not self.company_id.partner_id.inscr_est:
                  Severity: Minor
                  Found in br_point_sale/models/invoice_eletronic.py - About 35 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 _compute_amount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _compute_amount(self):
                          super(AccountInvoice, self)._compute_amount()
                          lines = self.invoice_line_ids
                          self.total_tax = sum(l.price_tax for l in lines)
                          self.icms_base = sum(l.icms_base_calculo for l in lines)
                  Severity: Minor
                  Found in br_account/models/account_invoice.py - About 35 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 validate_cpf has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def validate_cpf(cpf):
                      """Rotina para validação do CPF - Cadastro Nacional
                      de Pessoa Física.
                  
                      :Return: True or False
                  Severity: Minor
                  Found in br_base/tools/fiscal.py - About 35 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 tax_line_move_line_get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def tax_line_move_line_get(self):
                          res = super(AccountInvoice, self).tax_line_move_line_get()
                  
                          done_taxes = []
                          for tax_line in sorted(self.tax_line_ids, key=lambda x: -x.sequence):
                  Severity: Minor
                  Found in br_account/models/account_invoice.py - About 35 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 validate_cnpj has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def validate_cnpj(cnpj):
                      """ Rotina para validação do CNPJ - Cadastro Nacional
                      de Pessoa Juridica.
                  
                      :param string cnpj: CNPJ para ser validado
                  Severity: Minor
                  Found in br_base/tools/fiscal.py - About 35 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_taxes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _set_taxes(self):
                          super(AccountInvoiceLine, self)._set_taxes()
                          self._update_tax_from_ncm()
                          fpos = self.invoice_id.fiscal_position_id
                          if fpos:
                  Severity: Minor
                  Found in br_account/models/account_invoice_line.py - About 35 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 action_send_eletronic_invoice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def action_send_eletronic_invoice(self):
                          super(InvoiceEletronic, self).action_send_eletronic_invoice()
                          if self.model == '008' and self.state not in ('done', 'cancel'):
                              self.state = 'error'
                  
                  
                  Severity: Minor
                  Found in br_nfse/models/nfse_simpliss.py - About 35 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