akamhy/waybackpy

View on GitHub

Showing 25 of 26 total issues

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

        def cdx_api_manager(
            self, payload: Dict[str, str], headers: Dict[str, str]
        ) -> Generator[str, None, None]:
            """
            This method uses the pagination API of the CDX server if
    Severity: Minor
    Found in waybackpy/cdx_api.py - About 5 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 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

    File cdx_api.py has 329 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    This module interfaces the Wayback Machine's CDX server API.
    
    The module has WaybackMachineCDXServerAPI which should be used by the users of
    this module to consume the CDX server API.
    Severity: Minor
    Found in waybackpy/cdx_api.py - About 3 hrs to fix

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

            def after(
                self,
                year: Optional[int] = None,
                month: Optional[int] = None,
                day: Optional[int] = None,
        Severity: Minor
        Found in waybackpy/cdx_api.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 before has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def before(
                self,
                year: Optional[int] = None,
                month: Optional[int] = None,
                day: Optional[int] = None,
        Severity: Minor
        Found in waybackpy/cdx_api.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 near has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def near(
                self,
                year: Optional[int] = None,
                month: Optional[int] = None,
                day: Optional[int] = None,
        Severity: Minor
        Found in waybackpy/cdx_api.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 __init__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in waybackpy/cdx_api.py - About 1 hr to fix

          Function archive_url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def archive_url(self) -> str:
                  """
                  Reads the the JSON response data and returns
                  the timestamp if found and if not found raises
                  ArchiveNotInAvailabilityAPIResponse.
          Severity: Minor
          Found in waybackpy/availability_api.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 add_payload has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_payload(self, payload: Dict[str, str]) -> None:
                  """
                  Adds the payload to the payload dictionary.
                  """
                  if self.start_timestamp:
          Severity: Minor
          Found in waybackpy/cdx_api.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 snapshots has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def snapshots(self) -> Generator[CDXSnapshot, None, None]:
                  """
                  This function yields the CDX data lines as snapshots.
          
                  As it is a generator it exhaustible, the reason that this is
          Severity: Minor
          Found in waybackpy/cdx_api.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 near has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def near(
                  self,
                  year: Optional[int] = None,
                  month: Optional[int] = None,
                  day: Optional[int] = None,
          Severity: Minor
          Found in waybackpy/availability_api.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 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 full_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          def full_url(endpoint: str, params: Dict[str, Any]) -> str:
              """
              As the function's name already implies that it returns
              full URL, but why we need a function for generating full URL?
              The CDX server can support multiple arguments for parameters
          Severity: Minor
          Found in waybackpy/cdx_utils.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 after has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def after(
          Severity: Major
          Found in waybackpy/cdx_api.py - About 50 mins to fix

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

                def before(
            Severity: Major
            Found in waybackpy/cdx_api.py - About 50 mins to fix

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

                  def near(
              Severity: Major
              Found in waybackpy/cdx_api.py - About 50 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language