willforde/script.module.codequick

View on GitHub
script.module.codequick/lib/codequick/youtube.py

Summary

Maintainability
D
2 days
Test Coverage

File youtube.py has 488 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
from __future__ import absolute_import

# Standard Library Imports
import logging
Severity: Minor
Found in script.module.codequick/lib/codequick/youtube.py - About 7 hrs to fix

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

        def request_videos(self, ids):
            """
            Return all requested videos from cache.
    
            If requested video(s) are not cached, the video data will be
    Severity: Minor
    Found in script.module.codequick/lib/codequick/youtube.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 valid_playlistid has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def valid_playlistid(self, contentid):
            """
            Return a valid playlist uuid.
    
            Contentid can be a channel uuid, playlist uuid or channel uploads uuid.
    Severity: Minor
    Found in script.module.codequick/lib/codequick/youtube.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 _connect_v3 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def _connect_v3(self, api_type, query, loop=False):
            """
            Send API request and return response as a json object.
    
            :param str api_type: The type of api request to make.
    Severity: Minor
    Found in script.module.codequick/lib/codequick/youtube.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 playlist has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def playlist(plugin, contentid, pagetoken=None, enable_playlists=True, loop=False):
    Severity: Minor
    Found in script.module.codequick/lib/codequick/youtube.py - About 35 mins to fix

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

      def playlists(plugin, channel_id, show_all=True, pagetoken=None, loop=False):
      Severity: Minor
      Found in script.module.codequick/lib/codequick/youtube.py - About 35 mins to fix

        Function playlist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def playlist(plugin, contentid, pagetoken=None, enable_playlists=True, loop=False):
            """
            List all videos within youtube playlist
        
            :param Route plugin: Tools related to Route callbacks.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.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 playlists has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def playlists(plugin, channel_id, show_all=True, pagetoken=None, loop=False):
            """
            List all playlist for giving channel
        
            :param Route plugin: Tools related to Route callbacks.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.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 videos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def videos(self, video_ids, multi_channel=False):
                """
                Process VideoIDs and return listitems in a generator
        
                :param video_ids: List of all the videos to show.
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.py - About 25 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 playlist_items(self, playlist_id, pagetoken=None, loop=False):
                """
                Return all videos ids for giving playlist ID.
        
                Refer to 'https://developers.google.com/youtube/v3/docs/playlistItems/list'
        Severity: Major
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 2 hrs to fix
        script.module.codequick/lib/codequick/youtube.py on lines 300..323

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

        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 playlists(self, channel_id, pagetoken=None, loop=False):
                """
                Return all playlist for a giving channel_id.
        
                Refer to 'https://developers.google.com/youtube/v3/docs/playlists/list'
        Severity: Major
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 2 hrs to fix
        script.module.codequick/lib/codequick/youtube.py on lines 256..278

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

        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

            if u"nextPageToken" in feed:
                next_item = Listitem.next_page(contentid=contentid, pagetoken=feed[u"nextPageToken"])
                results.append(next_item)
        Severity: Major
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 1 hr to fix
        script.module.codequick/lib/codequick/youtube.py on lines 722..724

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

        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

            if u"nextPageToken" in feed:  # pragma: no branch
                next_item = Listitem.next_page(video_id=video_id, pagetoken=feed[u"nextPageToken"])
                results.append(next_item)
        Severity: Major
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 1 hr to fix
        script.module.codequick/lib/codequick/youtube.py on lines 683..685

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

        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 videos(self, video_id):
                """
                Return all available information for giving video/vidoes.
        
                Refer to 'https://developers.google.com/youtube/v3/docs/videos/list'
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 45 mins to fix
        script.module.codequick/lib/codequick/youtube.py on lines 212..234

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

        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 channels(self, channel_id):
                """
                Return all available information for giving channel
        
                Note:
        Severity: Minor
        Found in script.module.codequick/lib/codequick/youtube.py and 1 other location - About 45 mins to fix
        script.module.codequick/lib/codequick/youtube.py on lines 280..298

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

        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

        There are no issues that match your filters.

        Category
        Status