fuzeman/trakt.py

View on GitHub

Showing 118 of 249 total issues

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

    def map_items(cls, client, store, items, func, **kwargs):
Severity: Minor
Found in trakt/mapper/sync.py - About 35 mins to fix

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

        def recommended(self, period=None, extended=None, page=None, per_page=None, **kwargs):
    Severity: Minor
    Found in trakt/interfaces/shows/__init__.py - About 35 mins to fix

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

          def construct(cls, client, media, item, keys=None, **kwargs):
      Severity: Minor
      Found in trakt/mapper/core/base.py - About 35 mins to fix

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

            def shows(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 season_episode has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def season_episode(cls, client, season, episode_num, item=None, **kwargs):
          Severity: Minor
          Found in trakt/mapper/summary.py - About 35 mins to fix

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

                def _construct(cls, client, keys, info=None, index=None, **kwargs):
            Severity: Minor
            Found in trakt/objects/season.py - About 35 mins to fix

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

                  def _construct(cls, client, keys, info=None, index=None, **kwargs):
              Severity: Minor
              Found in trakt/objects/episode.py - About 35 mins to fix

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

                    def update(self, username, id, name=None, description=None, privacy=None, display_numbers=None,
                               allow_comments=None, return_type='object', **kwargs):
                        data = {
                            'name': name,
                            'description': description,
                Severity: Minor
                Found in trakt/interfaces/users/lists/list_.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 start has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def start(self, daemon=None):
                        if self._active or self._thread:
                            raise Exception('Poller already started')
                
                        # Construct thread process wrapper
                Severity: Minor
                Found in trakt/interfaces/oauth/device.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 _update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

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

                    def off(self, event=None, func=None):
                        self.__log('off(event: %s, func: %s)', repr(event), repr(func))
                
                        self.__ensure_constructed()
                
                
                Severity: Minor
                Found in trakt/core/emitter.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 transform_headers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def transform_headers(self):
                        headers = self.kwargs.get('headers') or {}
                        headers['Content-Type'] = 'application/json'
                
                        headers['trakt-api-version'] = '2'
                Severity: Minor
                Found in trakt/core/request.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, username, media=None, store=None, extended=None, page=None, per_page=None, **kwargs):
                
                        if not media or media not in ['shows', 'movies']:
                            raise ValueError('The "media" have to be  one of ["shows", "media"]')
                
                
                Severity: Minor
                Found in trakt/interfaces/users/watched.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, media=None, store=None, params=None, query=None, flat=False, **kwargs):
                        if not params:
                            params = []
                
                        params.insert(0, media)
                Severity: Minor
                Found in trakt/interfaces/sync/core/mixins.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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def get(self, page):
                        request = self.request.copy()
                
                        # Build query parameters
                        query = self.query.copy()
                Severity: Minor
                Found in trakt/core/pagination.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

                Avoid too many return statements within this function.
                Open

                            return PublicList._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 WatchedProgress._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 data
                    Severity: Major
                    Found in trakt/interfaces/base/__init__.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return True
                      Severity: Major
                      Found in trakt/core/http.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
                          Severity
                          Category
                          Status
                          Source
                          Language