krygal/samsung_multiroom

View on GitHub

Showing 52 of 52 total issues

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

    def set(self, *args):
        """
        Set equalizer values by preset name or list of band values

        :param: Name of the preset to set or list of 7 band values to set
Severity: Minor
Found in samsung_multiroom/equalizer/equalizer.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 get_current_track has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get_current_track(self):
        """
        Get current track info.

        :returns: Track instance, or None if unavailable
Severity: Minor
Found in samsung_multiroom/service/dlna/player.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 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 has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def set(self, time=None, weekdays=None, duration=None, volume=None, station_data=None, playlist=None, enabled=None):
Severity: Major
Found in samsung_multiroom/clock/alarm.py - About 50 mins to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, title, artist, album, duration, position, thumbnail_url, metadata=None):
    Severity: Major
    Found in samsung_multiroom/service/player.py - About 50 mins to fix

      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 get_current_track has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_current_track(self):
                """
                Get current track info.
        
                :returns: Track instance, or None if unavailable
        Severity: Minor
        Found in samsung_multiroom/service/app/player.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 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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, api, event_loop, clock, equalizer, player_operator, service_registry):
        Severity: Minor
        Found in samsung_multiroom/speaker.py - About 45 mins to fix

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

                      parent_id = next(iter([i.object_id for i in items if i.name == folder]), None)
          Severity: Minor
          Found in samsung_multiroom/service/app/browser.py and 1 other location - About 40 mins to fix
          samsung_multiroom/service/tunein/browser.py on lines 28..28

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

          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

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

                      parent_id = next(iter([i.object_id for i in items if i.name == folder]), None)
          Severity: Minor
          Found in samsung_multiroom/service/tunein/browser.py and 1 other location - About 40 mins to fix
          samsung_multiroom/service/app/browser.py on lines 33..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 34.

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

              def __init__(self, api, app_id, app_name, path=None, items=None):
          Severity: Minor
          Found in samsung_multiroom/service/app/browser.py - About 35 mins to fix

            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

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

                    if 'thumbnail' in data:
                        kwargs['metadata']['thumbnail_url'] = data['thumbnail']
            Severity: Major
            Found in samsung_multiroom/service/dlna/browser.py and 13 other locations - About 35 mins to fix
            samsung_multiroom/service/app/browser.py on lines 67..68
            samsung_multiroom/service/app/browser.py on lines 69..70
            samsung_multiroom/service/app/browser.py on lines 73..74
            samsung_multiroom/service/app/player.py on lines 112..113
            samsung_multiroom/service/dlna/browser.py on lines 63..64
            samsung_multiroom/service/dlna/browser.py on lines 65..66
            samsung_multiroom/service/dlna/browser.py on lines 72..73
            samsung_multiroom/service/dlna/browser.py on lines 74..75
            samsung_multiroom/service/dlna/browser.py on lines 76..77
            samsung_multiroom/service/dlna/browser.py on lines 78..79
            samsung_multiroom/service/dlna/player.py on lines 152..153
            samsung_multiroom/service/dlna/player.py on lines 154..155
            samsung_multiroom/service/tunein/browser.py on lines 56..57

            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 __getattribute__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getattribute__(self, name):
                    """
                    Magic is_[function]_supported method.
            
                    Function can be any Player method. In order to mark method as unsupported, use @unsupported decorator.
            Severity: Minor
            Found in samsung_multiroom/service/player.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 14 locations. Consider refactoring.
            Open

                    if 'artist' in data:
                        kwargs['metadata']['artist'] = data['artist']
            Severity: Major
            Found in samsung_multiroom/service/app/browser.py and 13 other locations - About 35 mins to fix
            samsung_multiroom/service/app/browser.py on lines 69..70
            samsung_multiroom/service/app/browser.py on lines 73..74
            samsung_multiroom/service/app/player.py on lines 112..113
            samsung_multiroom/service/dlna/browser.py on lines 63..64
            samsung_multiroom/service/dlna/browser.py on lines 65..66
            samsung_multiroom/service/dlna/browser.py on lines 70..71
            samsung_multiroom/service/dlna/browser.py on lines 72..73
            samsung_multiroom/service/dlna/browser.py on lines 74..75
            samsung_multiroom/service/dlna/browser.py on lines 76..77
            samsung_multiroom/service/dlna/browser.py on lines 78..79
            samsung_multiroom/service/dlna/player.py on lines 152..153
            samsung_multiroom/service/dlna/player.py on lines 154..155
            samsung_multiroom/service/tunein/browser.py on lines 56..57

            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

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

                    if 'thumbnail' in data:
                        kwargs['metadata']['thumbnail_url'] = data['thumbnail']
            Severity: Major
            Found in samsung_multiroom/service/tunein/browser.py and 13 other locations - About 35 mins to fix
            samsung_multiroom/service/app/browser.py on lines 67..68
            samsung_multiroom/service/app/browser.py on lines 69..70
            samsung_multiroom/service/app/browser.py on lines 73..74
            samsung_multiroom/service/app/player.py on lines 112..113
            samsung_multiroom/service/dlna/browser.py on lines 63..64
            samsung_multiroom/service/dlna/browser.py on lines 65..66
            samsung_multiroom/service/dlna/browser.py on lines 70..71
            samsung_multiroom/service/dlna/browser.py on lines 72..73
            samsung_multiroom/service/dlna/browser.py on lines 74..75
            samsung_multiroom/service/dlna/browser.py on lines 76..77
            samsung_multiroom/service/dlna/browser.py on lines 78..79
            samsung_multiroom/service/dlna/player.py on lines 152..153
            samsung_multiroom/service/dlna/player.py on lines 154..155

            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

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

                def is_active(self, function, submode=None):
                    """
                    Check if this player is active based on current function/submode.
            
                    :returns: Boolean True if function/submode is supported
            Severity: Minor
            Found in samsung_multiroom/service/dlna/player.py and 2 other locations - About 35 mins to fix
            samsung_multiroom/service/app/player.py on lines 124..130
            samsung_multiroom/service/tunein/player.py on lines 101..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

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

                    if 'device_udn' in music_info:
                        track_kwargs['metadata']['device_udn'] = music_info['device_udn']
            Severity: Major
            Found in samsung_multiroom/service/dlna/player.py and 13 other locations - About 35 mins to fix
            samsung_multiroom/service/app/browser.py on lines 67..68
            samsung_multiroom/service/app/browser.py on lines 69..70
            samsung_multiroom/service/app/browser.py on lines 73..74
            samsung_multiroom/service/app/player.py on lines 112..113
            samsung_multiroom/service/dlna/browser.py on lines 63..64
            samsung_multiroom/service/dlna/browser.py on lines 65..66
            samsung_multiroom/service/dlna/browser.py on lines 70..71
            samsung_multiroom/service/dlna/browser.py on lines 72..73
            samsung_multiroom/service/dlna/browser.py on lines 74..75
            samsung_multiroom/service/dlna/browser.py on lines 76..77
            samsung_multiroom/service/dlna/browser.py on lines 78..79
            samsung_multiroom/service/dlna/player.py on lines 154..155
            samsung_multiroom/service/tunein/browser.py on lines 56..57

            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

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

                    if 'artist' in data:
                        kwargs['metadata']['artist'] = data['artist']
            Severity: Major
            Found in samsung_multiroom/service/dlna/browser.py and 13 other locations - About 35 mins to fix
            samsung_multiroom/service/app/browser.py on lines 67..68
            samsung_multiroom/service/app/browser.py on lines 69..70
            samsung_multiroom/service/app/browser.py on lines 73..74
            samsung_multiroom/service/app/player.py on lines 112..113
            samsung_multiroom/service/dlna/browser.py on lines 65..66
            samsung_multiroom/service/dlna/browser.py on lines 70..71
            samsung_multiroom/service/dlna/browser.py on lines 72..73
            samsung_multiroom/service/dlna/browser.py on lines 74..75
            samsung_multiroom/service/dlna/browser.py on lines 76..77
            samsung_multiroom/service/dlna/browser.py on lines 78..79
            samsung_multiroom/service/dlna/player.py on lines 152..153
            samsung_multiroom/service/dlna/player.py on lines 154..155
            samsung_multiroom/service/tunein/browser.py on lines 56..57

            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