django/django

View on GitHub
django/utils/feedgenerator.py

Summary

Maintainability
D
1 day
Test Coverage

File feedgenerator.py has 369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Syndication feed generation library -- used for generating RSS, etc.

Sample usage:

Severity: Minor
Found in django/utils/feedgenerator.py - About 4 hrs to fix

    Function add_item has 16 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_item(
    Severity: Major
    Found in django/utils/feedgenerator.py - About 2 hrs to fix

      Function add_item_elements has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_item_elements(self, handler, item):
              handler.addQuickElement("title", item["title"])
              handler.addQuickElement("link", item["link"])
              if item["description"] is not None:
                  handler.addQuickElement("description", item["description"])
      Severity: Minor
      Found in django/utils/feedgenerator.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 __init__ has 14 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in django/utils/feedgenerator.py - About 1 hr to fix

        Function add_item_elements has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_item_elements(self, handler, item):
                handler.addQuickElement("title", item["title"])
                handler.addQuickElement("link", "", {"href": item["link"], "rel": "alternate"})
        
                if item["pubdate"] is not None:
        Severity: Minor
        Found in django/utils/feedgenerator.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 latest_post_date has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def latest_post_date(self):
                """
                Return the latest item's pubdate or updateddate. If no items
                have either of these attributes this return the current UTC date/time.
                """
        Severity: Minor
        Found in django/utils/feedgenerator.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 add_root_elements has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def add_root_elements(self, handler):
                handler.addQuickElement("title", self.feed["title"])
                handler.addQuickElement(
                    "link", "", {"rel": "alternate", "href": self.feed["link"]}
                )
        Severity: Minor
        Found in django/utils/feedgenerator.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

        There are no issues that match your filters.

        Category
        Status