osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

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

    def name_search(self, name='', args=None, operator='ilike', limit=100):
        ''' 让warehouse支持使用code来搜索'''
        args = args or []
        # 将name当成code搜
        if name and not filter(lambda _type: _type[0] == 'code', args):
Severity: Minor
Found in core/models/warehouse.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 unlink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def unlink(self):
    for record in self:
        if 'state' in record._fields.keys():
            if record.state == 'done':
                raise UserError(u'不能删除已确认的单据!')
Severity: Minor
Found in core/models/core.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 construction_action_url_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def construction_action_url_list(self, action, action_url_list):
        """
        把所有的数据整合,经过深度处理放进 action_url_list
        :param action: [home.page]对象,数据的来源。
        :param action_url_list: 存放数据的处理结果。
Severity: Minor
Found in home_page/models/home_page.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 asset_done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def asset_done(self):
        ''' 确认固定资产 '''
        self._wrong_asset_done()
        # 非初始化固定资产生成入账凭证
        if not self.is_init:
Severity: Minor
Found in asset/models/asset.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 view_detail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def view_detail(self):
        '''采购汇总表(按商品)查看明细按钮'''
        self.ensure_one()
        line_ids = []
        res = []
Severity: Minor
Found in buy/report/buy_summary_goods.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 _read_group_process_groupby has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _read_group_process_groupby(self, gb, query):
    res = groupby_original(self, gb, query)
    split = gb.split(':')
    gb_function = split[1] if len(split) == 2 else None
    if gb_function and gb_function == 'day':
Severity: Minor
Found in core/models/core.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 _prepare_buy_payment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _prepare_buy_payment(self, receipt):
        '''对于传入的入库单,为创建采购付款一览表准备数据'''
        self.ensure_one()
        factor = not receipt.is_return and 1 or -1  # 如果是退货则金额均取反
        purchase_amount = factor * (receipt.discount_amount + receipt.amount)
Severity: Minor
Found in buy/wizard/buy_payment_wizard.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 view_detail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def view_detail(self):
        '''采购汇总表(按供应商)查看明细按钮'''
        self.ensure_one()
        line_ids = []
        res = []
Severity: Minor
Found in buy/report/buy_summary_partner.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 buy_receipt_done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def buy_receipt_done(self):
        '''审核采购入库单/退货单,更新本单的付款状态/退款状态,并生成结算单和付款单'''
        # 报错
        self._wrong_receipt_done()
        # 调用wh.move中审核方法,更新审核人和审核状态
Severity: Minor
Found in buy/models/buy_receipt.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 _buy_amount_to_invoice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _buy_amount_to_invoice(self):
        '''采购费用产生结算单'''
        if sum(cost_line.amount for cost_line in self.cost_line_ids) > 0:
            for line in self.cost_line_ids:
                if not float_is_zero(line.amount, 2):
Severity: Minor
Found in buy/models/buy_receipt.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 onchange_account_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def onchange_account_id(self):
        self.currency_id = self.account_id.currency_id
        self.rate_silent = self.account_id.currency_id.rate
        res = {
            'domain': {
Severity: Minor
Found in finance/models/voucher_template.py - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language