eggplants/pyjlyric

View on GitHub

Showing 12 of 12 total issues

Function parse has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(url: str) -> UtatenLyricPage:
        """Parse the url page and return the result as LyricPage instance."""
        pattern = re.compile(_UTATEN_PATTERN)
        m = re.match(pattern, url)
        pageid = get_captured_value(m, "pageid")
Severity: Minor
Found in pyjlyric/utaten/parser.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_lyric_text has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_lyric_text(url: str) -> str | None:
    """CLI main."""
    r = parse(url)

    if r is None:
Severity: Minor
Found in pyjlyric/parse.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 parse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def parse(url: str) -> UtatenLyricPage:
        """Parse the url page and return the result as LyricPage instance."""
        pattern = re.compile(_UTATEN_PATTERN)
        m = re.match(pattern, url)
        pageid = get_captured_value(m, "pageid")
Severity: Minor
Found in pyjlyric/utaten/parser.py - About 1 hr to fix

    Function parse has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def parse(url: str) -> PetitlyricsLyricPage:
            """Parse the url page and return the result as LyricPage instance."""
            pattern = re.compile(_PETITLYRICS_PATTERN)
            m = re.match(pattern, url)
            pageid = get_captured_value(m, "pageid")
    Severity: Minor
    Found in pyjlyric/petitlyrics/parser.py - About 1 hr to fix

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

          def parse(url: str) -> JlyricLyricPage:
              """Parse the url page and return the result as LyricPage instance."""
              pattern = re.compile(_JLYRIC_PATTERN)
              m = re.match(pattern, url)
              pageid = get_captured_value(m, "pageid")
      Severity: Minor
      Found in pyjlyric/jlyric/parser.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse(url: str) -> UtanetLyricPage:
              """Parse the url page and return the result as LyricPage instance."""
              pattern = re.compile(_UTANET_PATTERN)
              m = re.match(pattern, url)
              pageid = get_captured_value(m, "pageid")
      Severity: Minor
      Found in pyjlyric/utanet/parser.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 parse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse(url: str) -> PetitlyricsLyricPage:
              """Parse the url page and return the result as LyricPage instance."""
              pattern = re.compile(_PETITLYRICS_PATTERN)
              m = re.match(pattern, url)
              pageid = get_captured_value(m, "pageid")
      Severity: Minor
      Found in pyjlyric/petitlyrics/parser.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_source has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_source(
          url: str,
          *,
          data: dict[str, str | int] | None = None,
          method: Literal["get", "post"] | None = "get",
      Severity: Minor
      Found in pyjlyric/util.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_source has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def get_source(
      Severity: Minor
      Found in pyjlyric/util.py - About 45 mins to fix

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

            def parse(url: str) -> MusicbookLyricPage:
                """Parse the url page and return the result as LyricPage instance."""
                pattern = re.compile(_MUSICBOOK_PATTERN)
                m = re.match(pattern, url)
                artistid = get_captured_value(m, "artistid")
        Severity: Minor
        Found in pyjlyric/musicbook/parser.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 convert_lines_into_sections has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def convert_lines_into_sections(lines: list[str]) -> list[list[str]]:
            lyric_sections = []
            now: list[str] = []
            for line in [*lines, ""]:
                if not line:
        Severity: Minor
        Found in pyjlyric/util.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 parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def parse(url: str) -> GakkiLyricPage:
                """Parse the url page and return the result as LyricPage instance."""
                pattern = re.compile(_GAKKI_PATTERN)
                m = re.match(pattern, url)
                pageid = get_captured_value(m, "pageid")
        Severity: Minor
        Found in pyjlyric/gakki/parser.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

        Severity
        Category
        Status
        Source
        Language