krygal/samsung_multiroom

View on GitHub
samsung_multiroom/api/api.py

Summary

Maintainability
F
4 days
Test Coverage
A
92%

File api.py has 963 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Low level api to communicate with samsung multiroom speaker."""
import inspect
import logging
import urllib.parse

Severity: Major
Found in samsung_multiroom/api/api.py - About 2 days to fix

    SamsungMultiroomApi has 68 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SamsungMultiroomApi:
        """
        Samsung Multiroom Api implementation.
    
        Contains non-inclusive list of API calls you can make to control the speaker.
    Severity: Major
    Found in samsung_multiroom/api/api.py - About 1 day to fix

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

      def format_param(param):
          """
          Format request parameter.
      
          :param param: Tuple e.g. ('list_count', 30, 'dec')
      Severity: Minor
      Found in samsung_multiroom/api/api.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 set_alarm_info has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def set_alarm_info(self, index, hour, minute, week, duration, volume, station_data):
      Severity: Major
      Found in samsung_multiroom/api/api.py - About 50 mins to fix

        Function paginator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def paginator(*args):
            """
            Generator to paginate over api call.
        
            Api method must accept start_index and list_count parameters.
        Severity: Minor
        Found in samsung_multiroom/api/api.py - About 45 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 set_playlist_playback_control has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_playlist_playback_control(self, items):
                """
                Create a playlist and playback.
        
                Use pc_get_music_list_by_id() to fetch item information required for playlist item.
        Severity: Minor
        Found in samsung_multiroom/api/api.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

        There are no issues that match your filters.

        Category
        Status