fuzeman/trakt.py

View on GitHub

Showing 118 of 249 total issues

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

    def get(self, source, media, collection=None, start_date=None, days=None, query=None, years=None, genres=None,
            languages=None, countries=None, runtimes=None, ratings=None, certifications=None, networks=None,
            status=None, **kwargs):
        """Retrieve calendar items.

Severity: Minor
Found in trakt/interfaces/calendars.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 import_subclass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def import_subclass(module_name, base):
    # TODO display a warning if multiple classes have been found?

    module = __import__(module_name, fromlist='*')
    result = None
Severity: Minor
Found in docs/conf.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 has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get(self, media=None, store=None, params=None, query=None, flat=False, **kwargs):
Severity: Minor
Found in trakt/interfaces/sync/core/mixins.py - About 45 mins to fix

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

        def _validate_oauth(self):
            config = self.client.configuration
    
            # Ensure token expiry is available
            if config['oauth.created_at'] is None or config['oauth.expires_in'] is None:
    Severity: Minor
    Found in trakt/core/http.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 progress has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def progress(self, progress_type, id, hidden=False, specials=False, count_specials=True, **kwargs):
    Severity: Minor
    Found in trakt/interfaces/shows/__init__.py - About 45 mins to fix

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

          def action(self, action, movie=None, show=None, episode=None, progress=0.0, **kwargs):
      Severity: Minor
      Found in trakt/interfaces/scrobble.py - About 45 mins to fix

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

            def _update(self, info=None, is_watched=None, is_collected=None, **kwargs):
                if not info:
                    return
        
                super(Video, self)._update(info, **kwargs)
        Severity: Minor
        Found in trakt/objects/video.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 movies has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def movies(self, username, id=None, start_at=None, end_at=None, store=None, **kwargs):
        Severity: Minor
        Found in trakt/interfaces/users/history.py - About 45 mins to fix

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

              def lookup(self, id, service=None, media=None, extended=None, page=None, per_page=None, **kwargs):
                  """Lookup items by their Trakt, IMDB, TMDB, TVDB, or TVRage ID.
          
                  **Note:** If you lookup an identifier without a :code:`media` type specified it
                  might return multiple items if the :code:`service` is not globally unique.
          Severity: Minor
          Found in trakt/interfaces/search.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 iterate_items has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def iterate_items(cls, client, store, items, func, media=None, **kwargs):
          Severity: Minor
          Found in trakt/mapper/sync.py - About 45 mins to fix

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

                def process(cls, client, store, items, media=None, flat=False, **kwargs):
            Severity: Minor
            Found in trakt/mapper/sync.py - About 45 mins to fix

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

                  def _update(self, info=None, in_watchlist=None, **kwargs):
                      if not info:
                          return
              
                      update_attributes(self, info, [
              Severity: Minor
              Found in trakt/objects/media.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 __iter__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __iter__(self):
                      if self.total_pages is None:
                          if self.exceptions:
                              raise ValueError("Pagination state hasn't been resolved")
              
              
              Severity: Minor
              Found in trakt/core/pagination.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 item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def item(cls, client, store, item, media=None, **kwargs):
                      i_type = item.get('type') or media
              
                      if not i_type:
                          raise ValueError('Unknown item type')
              Severity: Minor
              Found in trakt/mapper/sync.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 episodes has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def episodes(self, username, id=None, start_at=None, end_at=None, store=None, **kwargs):
              Severity: Minor
              Found in trakt/interfaces/users/history.py - About 45 mins to fix

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

                    def __call__(self, token=None, refresh_token=None, created_at=None, expires_in=None, refresh=None, username=None):
                Severity: Minor
                Found in trakt/core/configuration.py - About 45 mins to fix

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

                      def seasons(self, username, id=None, start_at=None, end_at=None, store=None, **kwargs):
                  Severity: Minor
                  Found in trakt/interfaces/users/history.py - About 45 mins to fix

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

                        def shows(self, username, id=None, start_at=None, end_at=None, store=None, **kwargs):
                    Severity: Minor
                    Found in trakt/interfaces/users/history.py - About 45 mins to fix

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

                          def movies(self, id=None, start_at=None, end_at=None, store=None, **kwargs):
                      Severity: Minor
                      Found in trakt/interfaces/sync/history.py - About 35 mins to fix

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

                            def seasons(self, id=None, start_at=None, end_at=None, store=None, **kwargs):
                        Severity: Minor
                        Found in trakt/interfaces/sync/history.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language