fuzeman/trakt.py

View on GitHub

Showing 249 of 249 total issues

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

    @property
    def id(self):
        """Retrieve the user identifier.

        :rtype: :class:`~python:int`
Severity: Major
Found in trakt/objects/user.py and 2 other locations - About 1 hr to fix
trakt/objects/comment.py on lines 95..107
trakt/objects/list/base.py on lines 146..158

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

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

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

    def on_expired(self):
        """Device authentication expired."""

        print('Authentication expired')

Severity: Major
Found in examples/authentication/device.py and 1 other location - About 1 hr to fix
examples/authentication/device.py on lines 70..82

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

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

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

    def on_aborted(self):
        """Device authentication aborted.

        Triggered when device authentication was aborted (either with `DeviceOAuthPoller.stop()`
        or via the "poll" event)
Severity: Major
Found in examples/authentication/device.py and 1 other location - About 1 hr to fix
examples/authentication/device.py on lines 103..111

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

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

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

                          for i_episode in i_season.get('episodes', []):
                              episode_num = i_episode.get('number')
              
                              cls.show_episode(client, season, episode_num, i_episode, **kwargs)
              Severity: Major
              Found in trakt/mapper/sync.py and 1 other location - About 1 hr to fix
              trakt/mapper/summary.py on lines 102..105

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

              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

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

                  def __init__(self, client, value=None, timestamp=None, votes=None):
                      self._client = client
              
                      self.value = value
                      """
              Severity: Major
              Found in trakt/objects/rating.py and 1 other location - About 1 hr to fix
              trakt/objects/progress.py on lines 260..282

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

              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

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

                  def __init__(self, pk=None):
                      self.progress_type = None
              
                      self.pk = pk
                      """
              Severity: Major
              Found in trakt/objects/progress.py and 1 other location - About 1 hr to fix
              trakt/objects/rating.py on lines 7..29

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

              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

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

                      for i_episode in item.get('episodes', []):
                          episode_num = i_episode.get('number')
              
                          cls.season_episode(client, season, episode_num, i_episode, **kwargs)
              Severity: Major
              Found in trakt/mapper/summary.py and 1 other location - About 1 hr to fix
              trakt/mapper/sync.py on lines 95..98

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

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

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

                  def remove(self, items, **kwargs):
                      """Remove specified items from the list.
              
                      :param items: Items that should be removed from the list
                      :type items: :class:`~python:list`
              Severity: Minor
              Found in trakt/objects/list/custom.py and 1 other location - About 55 mins to fix
              trakt/objects/list/custom.py on lines 20..33

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

              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

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

                  def add(self, items, **kwargs):
                      """Add specified items to the list.
              
                      :param items: Items that should be added to the list
                      :type items: :class:`~python:list`
              Severity: Minor
              Found in trakt/objects/list/custom.py and 1 other location - About 55 mins to fix
              trakt/objects/list/custom.py on lines 65..78

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

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