akamhy/waybackpy

View on GitHub
waybackpy/cdx_api.py

Summary

Maintainability
D
2 days
Test Coverage

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

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

                def __init__(
                    self,
                    url: str,
                    user_agent: str = DEFAULT_USER_AGENT,
                    start_timestamp: Optional[str] = None,
            Severity: Minor
            Found in waybackpy/cdx_api.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

            There are no issues that match your filters.

            Category
            Status