tidalf/plugin.audio.qobuz

View on GitHub

Showing 104 of 363 total issues

File main.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
    qobuz.node.inode.main
    ~~~~~~~~~~~~~~~~~~~~~

    :part_of: kodi-qobuz
Severity: Minor
Found in resources/lib/qobuz/node/inode/main.py - About 6 hrs to fix

    INode has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class INode(object):
        '''Our base node, every node must inherit or mimic is behaviour
    
            Calling build_down on a node start the build process
                - pre_build_down: Retrieve data (disk, internet...) and store
    Severity: Minor
    Found in resources/lib/qobuz/node/inode/main.py - About 6 hrs to fix

      File main.py has 419 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      '''
          qobuz.node.playlist
          ~~~~~~~~~~~~~~~~~~
      
          :part_of: kodi-qobuz
      Severity: Minor
      Found in resources/lib/qobuz/node/playlist/main.py - About 6 hrs to fix

        RawApi has 41 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class RawApi(object):
            def __init__(self):
                self.appid = '285473059'  # XBMC
                self.version = '0.2'
                self.baseUrl = 'http://www.qobuz.com/api.json'
        Severity: Minor
        Found in resources/lib/qobuz/api/raw.py - About 5 hrs to fix

          File favorite.py has 352 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          '''
              qobuz.node.favorite
              ~~~~~~~~~~~~~~~~~~~
          
              :part_of: kodi-qobuz
          Severity: Minor
          Found in resources/lib/qobuz/node/favorite.py - About 4 hrs to fix

            Node_playlist has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Node_playlist(INode):
                def __init__(self, parent=None, parameters=None, data=None):
                    parameters = {} if parameters is None else parameters
                    super(Node_playlist, self).__init__(
                        parent=parent, parameters=parameters, data=data)
            Severity: Minor
            Found in resources/lib/qobuz/node/playlist/main.py - About 4 hrs to fix

              File raw.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              '''
                  qobuz.api.raw
                  ~~~~~~~~~~~~~
              
                  Our base api, all method are mapped like in <endpoint>_<method>
              Severity: Minor
              Found in resources/lib/qobuz/api/raw.py - About 3 hrs to fix

                Node_track has 29 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Node_track(INode):
                    def __init__(self, parent=None, parameters=None, data=None):
                        parameters = {} if parameters is None else parameters
                        super(Node_track, self).__init__(parent=parent,
                                                         parameters=parameters,
                Severity: Minor
                Found in resources/lib/qobuz/node/track/main.py - About 3 hrs to fix

                  Function cached has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def cached(self, f, *a, **ka):
                          """Decorator
                              All positional and named parameters are used to make the key
                          """
                          that = self
                  Severity: Minor
                  Found in resources/lib/qobuz/cache/base_cache.py - About 3 hrs 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 list_albums has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def list_albums(self, qnt, qid):
                          ''' List albums givent a node type and a node id
                          '''
                          album_ids = {}
                          nodes = []
                  Severity: Minor
                  Found in resources/lib/qobuz/node/favorite.py - About 3 hrs 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

                  Node_favorite has 25 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Node_favorite(INode):
                      def __init__(self, parent=None, parameters=None, data=None):
                          parameters = {} if parameters is None else parameters
                          super(Node_favorite, self).__init__(
                              parent=parent, parameters=parameters, data=data)
                  Severity: Minor
                  Found in resources/lib/qobuz/node/favorite.py - About 2 hrs to fix

                    Function list_image has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def list_image(data, desired_size='xlarge'):
                        all_size = [desired_size]
                        _ = [all_size.append(s) for s in ['xlarge', 'large', 'small', 'thumbnail']]
                        result = []
                    
                    
                    Severity: Minor
                    Found in resources/lib/qobuz/util/data.py - About 2 hrs 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

                    File main.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    '''
                        qobuz.node.track.main
                        ~~~~~~~~~~~~~~~~~~~~~
                    
                        :part_of: kodi-qobuz
                    Severity: Minor
                    Found in resources/lib/qobuz/node/track/main.py - About 2 hrs to fix

                      Function make_url has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def make_url(self, **ka):
                              '''Generate URL to navigate between nodes
                                  Nodes with custom parameters must override this method
                                  @todo: Ugly need rewrite =]
                              '''
                      Severity: Minor
                      Found in resources/lib/qobuz/node/inode/main.py - About 2 hrs 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 stream_format has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def stream_format(self, track=None):
                              if self.is_free_account():
                                  return audio_format['mp3']
                              stream_type = config.app.registry.get('streamtype')
                              if track is not None:
                      Severity: Minor
                      Found in resources/lib/qobuz/api/user.py - About 2 hrs 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_image_from_storage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_image_from_storage(self):
                              desired_size = config.app.registry.get('image_default_size',
                                                                     default=None)
                              images = []
                              if self.nid is not None:
                      Severity: Minor
                      Found in resources/lib/qobuz/node/inode/main.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 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get(self, *a, **ka):
                              """Wrapper that cache query to our raw api. We are enforcing format
                              because cache entry key are made based on *a and **ka parameters.
                              ('artist/get' and '/artist/get' will generate different key)
                              Path are mapped to raw api and raise InvalidQuery on error
                      Severity: Minor
                      Found in resources/lib/qobuz/api/easy.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 _api_request has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _api_request(self, params, uri, **opt):
                              '''Qobuz API HTTP get request
                                  Arguments:
                                  params:    parameters dictionary
                                  uri   :    service/method
                      Severity: Minor
                      Found in resources/lib/qobuz/api/raw.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 __getattr__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __getattr__(self, attr):
                              if attr.startswith('get_') and hasattr(self, 'propsMap'):
                                  key = attr[4:]
                                  if key in self.propsMap:
                                      prop = self.propsMap.get(key)
                      Severity: Minor
                      Found in resources/lib/qobuz/node/inode/main.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 _add_tracks has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _add_tracks(cls, playlist_id, nodes):
                              if len(nodes) < 1:
                                  logger.warn('Empty list...')
                                  return False
                              step = 50
                      Severity: Minor
                      Found in resources/lib/qobuz/node/playlist/main.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

                      Severity
                      Category
                      Status
                      Source
                      Language