tobi-wan-kenobi/bumblebee-status

View on GitHub
bumblebee_status/modules/contrib/rss.py

Summary

Maintainability
B
4 hrs
Test Coverage
F
22%

File rss.py has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# pylint: disable=C0111,R0903

"""RSS news ticker

Fetches rss news items and shows these as a news ticker.
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.py - About 3 hrs to fix

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

    def _check_for_image(self, entry):
        image = next(
            iter([l["href"] for l in entry["links"] if l["rel"] == "enclosure"]), None
        )
        if not image and "media_content" in entry:
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.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 _create_news_section has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_news_section(self, newspaper_items):
        style = random.randint(0, 3)
        section = "<table><tr class='style" + str(style) + "'>"
        for i in range(0, 3):
            section += "<td><div class='itemcontainer'>"
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.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 _check_for_refresh has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _check_for_refresh(self):
        if self._feeds_to_update:
            # Update one feed at a time to not overload this update cycle
            url = self._feeds_to_update.pop()
            self._update_items_from_feed(url)
Severity: Minor
Found in bumblebee_status/modules/contrib/rss.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

There are no issues that match your filters.

Category
Status