fuzeman/trakt.py

View on GitHub

Showing 118 of 249 total issues

Function __init__ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, client, keys, user):
        self._client = client

        self.keys = keys
        """
Severity: Minor
Found in trakt/objects/list/base.py - About 1 hr to fix

    Function __init__ has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, client, keys, index=None):
            super(Movie, self).__init__(client, keys, index)
    
            self.title = None
            """
    Severity: Minor
    Found in trakt/objects/movie.py - About 1 hr to fix

      Function create has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def create(self, username, name, description=None, privacy='private', display_numbers=False,
      Severity: Major
      Found in trakt/interfaces/users/lists/__init__.py - About 1 hr to fix

        Function get has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get(self, media=None, id=None, start_at=None, end_at=None, store=None,
        Severity: Major
        Found in trakt/interfaces/sync/history.py - About 1 hr to fix

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

              def update(self, username, id, name=None, description=None, privacy=None, display_numbers=None,
          Severity: Major
          Found in trakt/interfaces/users/lists/list_.py - About 1 hr to fix

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

            def construct_map(client, d=None, interfaces=None):
                if d is None:
                    d = {}
            
                if interfaces is None:
            Severity: Minor
            Found in trakt/interfaces/__init__.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def get(self, username, media=None, id=None, start_at=None, end_at=None, store=None,
                        extended=None, page=None, per_page=None, **kwargs):
            
                    if not media and id:
                        raise ValueError('The "id" parameter also requires the "media" parameter to be defined')
            Severity: Minor
            Found in trakt/interfaces/users/history.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 synchronized has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def synchronized(f_lock, mode='full'):
                if mode == 'full':
                    mode = ['acquire', 'release']
                elif isinstance(mode, str):
                    mode = [mode]
            Severity: Minor
            Found in trakt/core/helpers.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 _process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _process(self):
                    while self._running:
                        # Ensure code hasn't expired yet
                        if self.has_expired():
                            self.emit('expired')
            Severity: Minor
            Found in trakt/interfaces/oauth/device.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 get has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def get(self, media=None, sort=None, store=None, extended=None, flat=False,
            Severity: Major
            Found in trakt/interfaces/sync/watchlist.py - About 1 hr to fix

              Function query has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def query(self, query, media=None, year=None, fields=None, extended=None, page=None, per_page=None, **kwargs):
              Severity: Major
              Found in trakt/interfaces/search.py - About 1 hr to fix

                Function get has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def get(self, username, media=None, rating=None, store=None, extended=None,
                Severity: Major
                Found in trakt/interfaces/users/ratings.py - About 1 hr to fix

                  Function get has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def get(self, media=None, rating=None, store=None, extended=None, flat=False, page=None, per_page=None, **kwargs):
                  Severity: Major
                  Found in trakt/interfaces/sync/ratings.py - About 1 hr to fix

                    Function get has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def get(self, username, media=None, sort=None, store=None, extended=None,
                    Severity: Major
                    Found in trakt/interfaces/users/watchlist.py - About 1 hr to fix

                      Function map_item has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def map_item(cls, client, store, item, media, key=None, parent=None, append=False, **kwargs):
                      Severity: Major
                      Found in trakt/mapper/sync.py - About 1 hr to fix

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

                        def update_attributes(obj, dictionary, keys):
                            if not dictionary:
                                return
                        
                            for key in keys:
                        Severity: Minor
                        Found in trakt/objects/core/helpers.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 action has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def action(self, action, movie=None, show=None, episode=None, progress=0.0, **kwargs):
                                """Perform scrobble action.
                        
                                :param action: Action to perform (either :code:`start`, :code:`pause` or :code:`stop`)
                                :type action: :class:`~python:str`
                        Severity: Minor
                        Found in trakt/interfaces/scrobble.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 lookup has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def lookup(self, id, service=None, media=None, extended=None, page=None, per_page=None, **kwargs):
                        Severity: Major
                        Found in trakt/interfaces/search.py - About 50 mins to fix

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

                              def get(self, username, media=None, store=None, extended=None, page=None, per_page=None, **kwargs):
                          Severity: Major
                          Found in trakt/interfaces/users/watched.py - About 50 mins to fix

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

                                def items(self, username, id, media=None, extended=None, page=None, per_page=None, **kwargs):
                            Severity: Major
                            Found in trakt/interfaces/users/lists/list_.py - About 50 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language