Trust-Code/odoo-brasil

View on GitHub

Showing 165 of 421 total issues

Function _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '001':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/invoice_eletronic.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 _create_statement has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_statement(self, stmt_values, account_number):
        BankStatement = self.env['account.bank.statement']
        BankStatementLine = self.env['account.bank.statement.line']
        filtered_values = []
        for transaction in stmt_values['transactions']:
Severity: Minor
Found in br_cnab/wizard/wizard_import_cnab.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 _compute_icms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_icms(self, price_base, ipi_value):
        icms_tax = self.filtered(lambda x: x.domain == 'icms')
        if not icms_tax:
            return []
        vals = self._tax_vals(icms_tax)
Severity: Minor
Found in br_account/models/account_tax.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 _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '008':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/nfse_simpliss.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 _prepare_eletronic_invoice_values has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_eletronic_invoice_values(self):
        res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
        if self.model == '002':
            tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
            dt_emissao = datetime.strptime(self.data_emissao, DTFT)
Severity: Minor
Found in br_nfse/models/nfse_ginfes.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 create has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def create(self, cr, uid, ids, datas, context=False):
        env = odoo.api.Environment(cr, uid, context or {})
        active_ids = context.get('active_ids')
        active_model = context.get('active_model')

Severity: Minor
Found in br_boleto/reports/report.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 _compute_price has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def _compute_price(self):
        currency = self.invoice_id and self.invoice_id.currency_id or None
        price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)

        valor_bruto = self.price_unit * self.quantity
Severity: Minor
Found in br_account/models/account_invoice_line.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if self.commercial_partner_id:
                partner = self.commercial_partner_id
                dest = {
                    'tipo': partner.company_type,
                    'cnpj_cpf': re.sub('[^0-9]', '', partner.cnpj_cpf or ''),
    Severity: Major
    Found in br_nfe/models/invoice_eletronic.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if responsavel_tecnico:
                  if len(responsavel_tecnico.child_ids) == 0:
                      raise UserError(
                          "Adicione um contato para o responsável técnico!")
      
      
      Severity: Major
      Found in br_nfe/models/invoice_eletronic.py - About 1 hr to fix

        Function get_bank has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_bank(bank):
                if bank == '237':
                    from .bancos.bradesco import Bradesco240
                    return Bradesco240
                elif bank == '756':
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/cnab_240.py - About 55 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 _check_cnab has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_cnab(self, cnab_file):
                if int(base64.b64decode(cnab_file)[0:3]) != int(
                        self.journal_id.bank_id.bic):
                    raise UserError(u"O banco do arquivo não corresponde ao\
                        banco do Diário Contábil!")
        Severity: Minor
        Found in br_cnab/wizard/wizard_import_cnab.py - About 55 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_result has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_result(self, zip_obj=None):
                if zip_obj:
                    zip_code = zip_obj.zip
                    if len(zip_code) == 8:
                        zip_code = '%s-%s' % (zip_code[0:5], zip_code[5:8])
        Severity: Minor
        Found in br_zip/models/br_zip.py - About 55 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 modulo10 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def modulo10(num):
                if not isinstance(num, basestring):
                    raise TypeError
                soma = 0
                peso = 2
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/bancos/itau.py - About 55 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_cancel has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def action_cancel(self):
                res = super(AccountInvoice, self).action_cancel()
                for item in self:
                    edocs = self.env['invoice.eletronic'].search(
                        [('invoice_id', '=', item.id)])
        Severity: Minor
        Found in br_account_einvoice/models/account_invoice.py - About 55 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 _onchange_despesas_frete_seguro has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _onchange_despesas_frete_seguro(self):
                amount = 0
                for line in self.order_line:
                    if line.product_id.fiscal_type == 'product':
                        amount += line.valor_bruto - line.valor_desconto
        Severity: Minor
        Found in br_sale_stock/models/sale.py - About 55 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 modulo11 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def modulo11(self, num, base=9, r=0):
                if not isinstance(num, basestring):
                    raise TypeError
                soma = 0
                fator = 2
        Severity: Minor
        Found in br_cnab/febraban/cnab_240/bancos/bradesco.py - About 45 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 _check_cnpj_cpf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_cnpj_cpf(self):
                check_cnpj_cpf = True
                if self.cnpj_cpf:
                    if self.cpfcnpj_type == 'cnpj':
                        if not fiscal.validate_cnpj(self.cnpj_cpf):
        Severity: Minor
        Found in br_account/models/br_account.py - About 45 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_worked_day_lines has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_worked_day_lines(self, contract_ids, date_from, date_to):
                res = super(HrPayslip, self).get_worked_day_lines(
                    contract_ids, date_from, date_to)
                for contract in contract_ids:
                    leaves = self.env['hr.holidays'].search(
        Severity: Minor
        Found in br_hr_payroll/model/hr_payslip.py - About 45 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 _invoice_total has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _invoice_total(self):
                account_invoice_report = self.env['account.invoice.report']
                if not self.ids:
                    self.total_invoiced = 0.0
                    return True
        Severity: Minor
        Found in br_account/models/res_partner.py - About 45 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 seach_by_address has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def seach_by_address(self, obj, country_id=False, state_id=False,
        Severity: Minor
        Found in br_zip/models/br_zip.py - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language