janw/tapedrive

View on GitHub

Showing 14 of 14 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

self.podcast = get_object_or_404(
(Podcast.objects.prefetch_related("episodes", "episodes").prefetch_related("subscribers", "subscribers"))
.annotate(num_episodes=Count("episodes"))
.annotate(downloaded_episodes=Count(Case(When(episodes__downloaded__isnull=False, then=1))))
.annotate(last_episode_date=Max("episodes__published")),
Severity: Major
Found in podcasts/views.py and 1 other location - About 3 hrs to fix
podcasts/views.py on lines 45..49

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Podcast.objects.prefetch_related("subscribers", "subscribers")
.prefetch_related("followers", "followers")
.annotate(num_episodes=Count("episodes"))
.annotate(downloaded_episodes=Count(Case(When(episodes__downloaded__isnull=False, then=1))))
.annotate(last_episode_date=Max("episodes__published"))
Severity: Major
Found in podcasts/views.py and 1 other location - About 3 hrs to fix
podcasts/views.py on lines 74..78

File podcast.py has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
from urllib.parse import urlencode, urlparse, urlunparse
 
import requests
from actstream import action
Severity: Minor
Found in podcasts/models/podcast.py - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    storage_directory = models.CharField(
    null=False,
    blank=False,
    max_length=255,
    default=STORAGE_DIRECTORY,
    Severity: Major
    Found in podcasts/models/__init__.py and 1 other location - About 1 hr to fix
    podcasts/models/__init__.py on lines 31..38

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    naming_scheme = models.CharField(
    null=False,
    blank=False,
    max_length=255,
    default=DEFAULT_NAMING_SCHEME,
    Severity: Major
    Found in podcasts/models/__init__.py and 1 other location - About 1 hr to fix
    podcasts/models/__init__.py on lines 22..29

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    @action(detail=True, renderer_classes=[renderers.StaticHTMLRenderer])
    def shownotes(self, request, *args, **kwargs):
    episode = self.get_object()
    return Response(episode.shownotes)
    Severity: Major
    Found in podcasts/api/views.py and 1 other location - About 1 hr to fix
    podcasts/api/views.py on lines 28..31

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    @action(detail=True, renderer_classes=[renderers.StaticHTMLRenderer])
    def summary(self, request, *args, **kwargs):
    podcast = self.get_object()
    return Response(podcast.summary_p)
    Severity: Major
    Found in podcasts/api/views.py and 1 other location - About 1 hr to fix
    podcasts/api/views.py on lines 69..72

    Function __iter__ has a Cognitive Complexity of 23 (exceeds 18 allowed). Consider refactoring.
    Open

    def __iter__(self, **kwargs):
    allowed_domains = kwargs.pop("allowed_domains", [])
    for token in Filter.__iter__(self):
    if token["type"] in ["StartTag", "EmptyTag"] and token["data"]:
    data_alt = None
    Severity: Minor
    Found in podcasts/utils/filters.py - About 1 hr to fix

    Function create_default_settings has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_default_settings(
    Severity: Minor
    Found in podcasts/apps.py - About 45 mins to fix

      Function update has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def update(
      Severity: Minor
      Found in podcasts/models/podcast.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

        if data_alt:
        token["data"][(None, "data-alt")] = data_alt
        yield token
        Severity: Major
        Found in podcasts/utils/filters.py - About 45 mins to fix

          Function queue_download_task has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def queue_download_task(
          Severity: Minor
          Found in podcasts/models/episode.py - About 35 mins to fix

            Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def __init__(self, verbose_name=None, name=None, min_value=None, max_value=None, **kwargs):
            Severity: Minor
            Found in podcasts/models/__init__.py - About 35 mins to fix

              Avoid too many return statements within this function.
              Open

              return
              Severity: Major
              Found in podcasts/utils/__init__.py - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language