akamhy/waybackpy

View on GitHub
waybackpy/cli.py

Summary

Maintainability
D
2 days
Test Coverage

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

"""
Module responsible for enabling waybackpy to function as a CLI tool.
"""

import os
Severity: Minor
Found in waybackpy/cli.py - About 6 hrs to fix

    Function handle_cdx has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def handle_cdx(data: List[Any]) -> None:
        """
        Handles the CDX CLI options and output format.
        """
        url = data[0]
    Severity: Minor
    Found in waybackpy/cli.py - About 4 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 main has 30 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def main(  # pylint: disable=no-value-for-parameter
    Severity: Major
    Found in waybackpy/cli.py - About 3 hrs to fix

      Function main has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(  # pylint: disable=no-value-for-parameter
          user_agent: str,
          version: bool,
          show_license: bool,
          newest: bool,
      Severity: Minor
      Found in waybackpy/cli.py - About 3 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 save_urls_on_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def save_urls_on_file(url_gen: Generator[str, None, None]) -> None:
          """
          Save output of CDX API on file.
          Mainly here because of backwards compatibility.
          """
      Severity: Minor
      Found in waybackpy/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 handle_cdx_closest_derivative_methods has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def handle_cdx_closest_derivative_methods(
          cdx_api: "WaybackMachineCDXServerAPI",
          oldest: bool,
          near: bool,
          newest: bool,
      Severity: Minor
      Found in waybackpy/cli.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 handle_cdx_closest_derivative_methods has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def handle_cdx_closest_derivative_methods(
      Severity: Minor
      Found in waybackpy/cli.py - About 35 mins to fix

        There are no issues that match your filters.

        Category
        Status