fuzeman/trakt.py

View on GitHub

Showing 118 of 249 total issues

Avoid too many return statements within this function.
Open

            return Comment._construct(client, keys, item, **kwargs)
Severity: Major
Found in trakt/mapper/core/base.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return CustomList._construct(client, keys, item, **kwargs)
    Severity: Major
    Found in trakt/mapper/core/base.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return User._construct(client, keys, item, **kwargs)
      Severity: Major
      Found in trakt/mapper/core/base.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return items
        Severity: Major
        Found in trakt/core/pagination.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return Person._construct(client, keys, item, **kwargs)
          Severity: Major
          Found in trakt/mapper/core/base.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return CollectionProgress._construct(client, item, **kwargs)
            Severity: Major
            Found in trakt/mapper/core/base.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return False
              Severity: Major
              Found in trakt/core/http.py - About 30 mins to fix

                Function episode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def episode(cls, client, item, **kwargs):
                        if 'episode' in item:
                            i_episode = item['episode']
                        else:
                            i_episode = item
                Severity: Minor
                Found in trakt/mapper/list_item.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 on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on(self, events, func=None, on_bound=None):
                        if not func:
                            # assume decorator, wrap
                            return self.__wrap(self.on, events, on_bound=on_bound)
                
                
                Severity: Minor
                Found in trakt/core/emitter.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 query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def query(self, query, media=None, year=None, fields=None, extended=None, page=None, per_page=None, **kwargs):
                        """Search by titles, descriptions, translated titles, aliases, and people.
                
                        **Note:** Results are ordered by the most relevant score.
                
                
                Severity: Minor
                Found in trakt/interfaces/search.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 episode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def episode(cls, client, item, **kwargs):
                        if 'episode' in item:
                            i_episode = item['episode']
                        else:
                            i_episode = item
                Severity: Minor
                Found in trakt/mapper/search.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 find_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def find_list(self, index):
                        count = len(self)
                
                        if index >= count:
                            raise IndexError()
                Severity: Minor
                Found in trakt/core/context_collection.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_interfaces has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_interfaces():
                    for interface in INTERFACES:
                        if not interface.path:
                            continue
                
                
                Severity: Minor
                Found in trakt/interfaces/__init__.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 custom_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def custom_list(cls, client, item, username=None, **kwargs):
                        if 'list' in item:
                            i_list = item['list']
                        else:
                            i_list = item
                Severity: Minor
                Found in trakt/mapper/list.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, username, media=None, sort=None, store=None, extended=None,
                            page=None, per_page=None, **kwargs):
                
                        # Build parameters
                        params = []
                Severity: Minor
                Found in trakt/interfaces/users/watchlist.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, username, media=None, rating=None, store=None, extended=None,
                            page=None, per_page=None, **kwargs):
                
                        # Build parameters
                        params = []
                Severity: Minor
                Found in trakt/interfaces/users/ratings.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 season has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def season(cls, client, item, **kwargs):
                        if not item:
                            return None
                
                        if 'season' in item:
                Severity: Minor
                Found in trakt/mapper/summary.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 episode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def episode(cls, client, item, parse_show=False, **kwargs):
                        if not item:
                            return None
                
                        if 'episode' in item:
                Severity: Minor
                Found in trakt/mapper/summary.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