fuzeman/trakt.py

View on GitHub

Showing 249 of 249 total issues

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 _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/show.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 get has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get(self, media, collection=None, start_date=None, days=None, **kwargs):
        Severity: Minor
        Found in trakt/interfaces/calendars.py - About 35 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

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

                  def episode(cls, client, store, item, append=False, **kwargs):
              Severity: Minor
              Found in trakt/mapper/sync.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 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

                    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 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

                    Similar blocks of code found in 9 locations. Consider refactoring.
                    Open

                        @authenticated
                        def shows(self, username, sort=None, store=None, **kwargs):
                            return self.get(
                                username, 'shows',
                    Severity: Major
                    Found in trakt/interfaces/users/watchlist.py and 8 other locations - About 35 mins to fix
                    trakt/interfaces/users/ratings.py on lines 74..77
                    trakt/interfaces/users/ratings.py on lines 83..86
                    trakt/interfaces/users/ratings.py on lines 92..95
                    trakt/interfaces/users/ratings.py on lines 101..104
                    trakt/interfaces/users/ratings.py on lines 110..113
                    trakt/interfaces/users/watchlist.py on lines 77..80
                    trakt/interfaces/users/watchlist.py on lines 95..98
                    trakt/interfaces/users/watchlist.py on lines 104..107

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    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

                    Similar blocks of code found in 9 locations. Consider refactoring.
                    Open

                        @authenticated
                        def movies(self, username, rating=None, store=None, **kwargs):
                            return self.get(
                                username, 'movies',
                    Severity: Major
                    Found in trakt/interfaces/users/ratings.py and 8 other locations - About 35 mins to fix
                    trakt/interfaces/users/ratings.py on lines 74..77
                    trakt/interfaces/users/ratings.py on lines 92..95
                    trakt/interfaces/users/ratings.py on lines 101..104
                    trakt/interfaces/users/ratings.py on lines 110..113
                    trakt/interfaces/users/watchlist.py on lines 77..80
                    trakt/interfaces/users/watchlist.py on lines 86..89
                    trakt/interfaces/users/watchlist.py on lines 95..98
                    trakt/interfaces/users/watchlist.py on lines 104..107

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    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

                    Similar blocks of code found in 9 locations. Consider refactoring.
                    Open

                        @authenticated
                        def shows(self, username, rating=None, store=None, **kwargs):
                            return self.get(
                                username, 'shows',
                    Severity: Major
                    Found in trakt/interfaces/users/ratings.py and 8 other locations - About 35 mins to fix
                    trakt/interfaces/users/ratings.py on lines 74..77
                    trakt/interfaces/users/ratings.py on lines 83..86
                    trakt/interfaces/users/ratings.py on lines 101..104
                    trakt/interfaces/users/ratings.py on lines 110..113
                    trakt/interfaces/users/watchlist.py on lines 77..80
                    trakt/interfaces/users/watchlist.py on lines 86..89
                    trakt/interfaces/users/watchlist.py on lines 95..98
                    trakt/interfaces/users/watchlist.py on lines 104..107

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    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

                    Similar blocks of code found in 9 locations. Consider refactoring.
                    Open

                        @authenticated
                        def all(self, username, rating=None, store=None, **kwargs):
                            return self.get(
                                username, 'all',
                    Severity: Major
                    Found in trakt/interfaces/users/ratings.py and 8 other locations - About 35 mins to fix
                    trakt/interfaces/users/ratings.py on lines 83..86
                    trakt/interfaces/users/ratings.py on lines 92..95
                    trakt/interfaces/users/ratings.py on lines 101..104
                    trakt/interfaces/users/ratings.py on lines 110..113
                    trakt/interfaces/users/watchlist.py on lines 77..80
                    trakt/interfaces/users/watchlist.py on lines 86..89
                    trakt/interfaces/users/watchlist.py on lines 95..98
                    trakt/interfaces/users/watchlist.py on lines 104..107

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 33.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language