push-things/django-th

View on GitHub

Showing 22 of 106 total issues

File my_mastodon.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8
import arrow

# django classes
from django.conf import settings
Severity: Minor
Found in th_mastodon/my_mastodon.py - About 2 hrs to fix

    File services.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # coding: utf-8
    # django stuff
    from django.conf import settings
    from django.core.cache import caches
    from django.urls import reverse
    Severity: Minor
    Found in django_th/services/services.py - About 2 hrs to fix

      Function read_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_data(self, **kwargs):
              """
                  get the data from the service
                  as the pushbullet service does not have any date
                  in its API linked to the note,
      Severity: Minor
      Found in th_pushbullet/my_pushbullet.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

      Function _get_published has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_published(self, entry):
              """
              get the 'published' attribute
              :param entry:
              :return:
      Severity: Minor
      Found in th_rss/my_rss.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

      Function _set_full_content has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _set_full_content(self, site_title, title, published,
      Severity: Major
      Found in th_pelican/my_pelican.py - About 50 mins to fix

        Function trigger_edit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def trigger_edit(request, trigger_id, edit_what):
            """
                edit the provider
                :param request: request object
                :param trigger_id: ID of the trigger to edit
        Severity: Minor
        Found in django_th/views_fbv.py - About 45 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 get_queryset has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_queryset(self):
                filtered_by = None
                # by default, sort by date_created
                ordered_by = (str('-date_triggered'), )
                # get the Trigger of the connected user
        Severity: Minor
        Found in django_th/views.py - About 45 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

        Avoid deeply nested control flow statements.
        Open

                                if date_triggered is not None and \
                                   published is not None and \
                                   now >= published >= date_triggered:
                                    my_toots.append({'title': title,
                                                     'content': s['content'],
        Severity: Major
        Found in th_mastodon/my_mastodon.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if twitter_obj.fav:
                                      url = twitter_fav_url.format(screen_name, s['id_str'])
                                      title = _('Tweet Fav from @{}'.format(screen_name))
                                  else:
                                      url = twitter_status_url.format(screen_name, s['id_str'])
          Severity: Major
          Found in th_twitter/my_twitter.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if newest is None:
                                        newest = True
                                        max_id = s['id'] - 1
                                    screen_name = s['user']['screen_name']
            Severity: Major
            Found in th_twitter/my_twitter.py - About 45 mins to fix

              Function _get_content has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _get_content(data, which_content):
                      """
                          get the content that could be hidden
                          in the middle of "content" or "summary detail"
                          from the data of the provider
              Severity: Minor
              Found in django_th/services/services.py - About 45 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 read_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def read_data(self, **kwargs):
                      """
                          get the data from the service
                          :param kwargs: contain keyword args : trigger_id at least
                          :type kwargs: dict
              Severity: Minor
              Found in th_github/my_github.py - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                      if date_triggered is not None and published is not None and now >= published >= date_triggered:
                                          if s.get('extended_entities'):
                                              # get a media
                                              extended_entities = s['extended_entities']
                                              if extended_entities.get('media'):
              Severity: Major
              Found in th_twitter/my_twitter.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if condition2:
                                            continue
                        if condition1 and condition2 is False:
                Severity: Major
                Found in th_rss/lib/conditionchecker/conditionchecker.py - About 45 mins to fix

                  Function _create_entry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _create_entry(self, title, data, tags):
                          """
                              create an entry
                              :param title: string
                              :param data: dict
                  Severity: Minor
                  Found in th_wallabag/my_wallabag.py - About 45 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

                  Avoid deeply nested control flow statements.
                  Open

                                          if newest is None:
                                              newest = True
                                              max_id = s['id'] - 1
                                          toot_name = s['account']['username']
                  Severity: Major
                  Found in th_mastodon/my_mastodon.py - About 45 mins to fix

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

                        def _create_content(self, site_title, content, pelican_path, url, **data):
                    Severity: Minor
                    Found in th_pelican/my_pelican.py - About 35 mins to fix

                      Function read_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def read_data(self, **kwargs):
                              """
                                  get the data from the service
                                  as the pocket service does not have any date
                                  in its API linked to the note,
                      Severity: Minor
                      Found in th_reddit/my_reddit.py - About 35 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 save_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def save_data(self, trigger_id, **data):
                              """
                                  let's save the data
                                  :param trigger_id: trigger ID from which to save data
                                  :param data: the data to check to be used and save
                      Severity: Minor
                      Found in th_todoist/my_todoist.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 get_tag has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_tag(note_store, my_tags):
                              """
                                  get the tags from his Evernote account
                                  :param note_store Evernote Instance
                                  :param my_tags string
                      Severity: Minor
                      Found in th_evernote/evernote_mgr.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