kacotam-si/portal-core

View on GitHub

Showing 3 of 10 total issues

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

    def render_to_csv(self, data, fieldnames=None, with_bom=True,
                      fail_silent=True):
        response = HttpResponse(content_type=self.content_type)
        response['Content-Disposition'] = self.get_context_disposition()
        if with_bom:
Severity: Minor
Found in portal_core/mixins.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

def get_words(text, customdict=None):
    """ 与えられたテキストを形態素解析して、含まれる名詞のリストを返す """

    def _filter(s):
        """ 名詞だけにフィルタリングする """
Severity: Minor
Found in portal_core/utils/text_tools.py - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

Function get_bank_openday has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def get_bank_openday(target_date):
    """ 指定日から最寄りの銀行営業日を取得 """
    # 銀行法施行令により、12/31〜1/3が年末年始の銀行休日となる
    if datetime.date(target_date.year, 12, 31) <= target_date <= datetime.date(target_date.year + 1, 1, 3):
        # 前営業日
Severity: Minor
Found in portal_core/utils/bank.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

Severity
Category
Status
Source
Language