nephila/djangocms-blog

View on GitHub

Showing 24 of 73 total issues

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

    def get_months(self, queryset=None, current_site=True):
        """
        Get months with aggregate count (how much posts is in the month).
        Results are ordered by date.
        """
Severity: Minor
Found in djangocms_blog/managers.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 items has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def items(self):
        items = []
        self.url_cache.clear()
        for lang in get_language_list():
            self.url_cache[lang] = {}
Severity: Minor
Found in djangocms_blog/sitemaps/__init__.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 populate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(self):
        if (
            not self.is_current_app and not get_setting("ENABLE_THROUGH_TOOLBAR_MENU")
        ) or not self.request.user.has_perm("djangocms_blog.add_post"):
            return  # pragma: no cover
Severity: Minor
Found in djangocms_blog/cms_toolbars.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 _clean_html has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _clean_html(self, content):
        body = BytesIO(content)
        document = etree.iterparse(body, html=True)
        for _a, element in document:
            if not (element.text and element.text.strip()) and len(element) == 0 and element.tag == "p":
Severity: Minor
Found in djangocms_blog/feeds.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