django/django

View on GitHub
django/utils/feedgenerator.py

Summary

Maintainability
C
1 day
Test Coverage

File feedgenerator.py has 318 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 3 hrs to fix

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

        def add_item(self, title, link, description, author_email=None,
    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__(self, title, link, description, language=None, author_email=None,
      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']})
                if self.feed['feed_url'] is not None:
                    handler.addQuickElement("link", "", {"rel": "self", "href": self.feed['feed_url']})
        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