ocaballeror/LyricFetch

View on GitHub

Showing 21 of 21 total issues

File scraping.py has 432 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Scraping functions.
"""
import ssl
import json
Severity: Minor
Found in lyricfetch/scraping.py - About 6 hrs to fix

    Function parse_argv has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_argv():
        """
        Parse command line arguments. Settings will be stored in the global
        variables declared above.
        """
    Severity: Minor
    Found in lyricfetch/cli.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 darklyrics has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def darklyrics(song):
        """
        Returns the lyrics found in darklyrics for the specified mp3 file or an
        empty string if not found.
        """
    Severity: Minor
    Found in lyricfetch/scraping.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 calculate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def calculate(self):
            """
            Calculate the overall counts of best, worst, fastest, slowest, total
            found, total not found and total runtime
    
    
    Severity: Minor
    Found in lyricfetch/stats.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 lyricscom has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def lyricscom(song):
        """
        Returns the lyrics found in lyrics.com for the specified mp3 file or an
        empty string if not found.
        """
    Severity: Minor
    Found in lyricfetch/scraping.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 run_mp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def run_mp(songs):
        """
        Concurrently calls get_lyrics to fetch the lyrics of a large list of songs.
        """
        stats = Stats()
    Severity: Minor
    Found in lyricfetch/run.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 lyricswikia has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def lyricswikia(song):
        """
        Returns the lyrics found in lyrics.wikia.com for the specified mp3 file or
        an empty string if not found.
        """
    Severity: Minor
    Found in lyricfetch/scraping.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_lyrics has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_lyrics(song, l_sources=None):
        """
        Searches for lyrics of a single song and returns a Result object with the
        various stats collected in the process.
    
    
    Severity: Minor
    Found in lyricfetch/run.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 exclude_sources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def exclude_sources(exclude, section=False):
        """
        Returns a narrower list of sources.
    
        If the exclude parameter is a list, every one of its items will be removed
    Severity: Minor
    Found in lyricfetch/run.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 get_lyrics_threaded has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_lyrics_threaded(song, l_sources=None):
        """
        Launches a pool of threads to search for the lyrics of a single song.
    
        The optional parameter 'sources' specifies an alternative list of sources.
    Severity: Minor
    Found in lyricfetch/run.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 get_current_cmus has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_current_cmus():
        """
        Get the current song from cmus.
        """
        result = subprocess.run('cmus-remote -Q'.split(' '), check=True,
    Severity: Minor
    Found in lyricfetch/song.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 avg_time has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def avg_time(self, source=None):
            """
            Returns the average time taken to scrape lyrics. If a string or a
            function is passed as source, return the average time taken to scrape
            lyrics from that source, otherwise return the total average.
    Severity: Minor
    Found in lyricfetch/stats.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 get_lastfm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_lastfm(method, lastfm_key='', **kwargs):
        """
        Request the specified method from the lastfm api.
        """
        if not lastfm_key:
    Severity: Minor
    Found in lyricfetch/scraping.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

    Avoid too many return statements within this function.
    Open

            return song
    Severity: Major
    Found in lyricfetch/song.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return text.strip()
      Severity: Major
      Found in lyricfetch/scraping.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return None
        Severity: Major
        Found in lyricfetch/song.py - About 30 mins to fix

          Function get_info_mpris2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def get_info_mpris2(name):
              """
              Get the current playing song from an mpris2 compliant player.
              """
              # qdbus org.mpris.MediaPlayer2.<name> /org/mpris/MediaPlayer2\
          Severity: Minor
          Found in lyricfetch/song.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

          Function metalarchives has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def metalarchives(song):
              """
              Returns the lyrics found in MetalArchives for the specified mp3 file or an
              empty string if not found.
              """
          Severity: Minor
          Found in lyricfetch/scraping.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

          Function from_filename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def from_filename(cls, filename):
                  """
                  Class constructor using the path to the corresponding mp3 file. The
                  metadata will be read from this file to create the song object, so it
                  must at least contain valid ID3 tags for artist and title.
          Severity: Minor
          Found in lyricfetch/song.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

          Function letras has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def letras(song):
              """
              Returns the lyrics found in letras.com for the specified mp3 file or an
              empty string if not found.
              """
          Severity: Minor
          Found in lyricfetch/scraping.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

          Severity
          Category
          Status
          Source
          Language