john-kurkowski/tldextract

View on GitHub
tldextract/tldextract.py

Summary

Maintainability
C
1 day
Test Coverage

File tldextract.py has 416 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""`tldextract` accurately separates a URL's subdomain, domain, and public suffix.

It does this via the Public Suffix List (PSL).

    >>> import tldextract
Severity: Minor
Found in tldextract/tldextract.py - About 6 hrs to fix

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

        def suffix_index(
            self, spl: list[str], include_psl_private_domains: bool | None = None
        ) -> tuple[int, bool]:
            """Return the index of the first suffix label, and whether it is private.
    
    
    Severity: Minor
    Found in tldextract/tldextract.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 _extract_netloc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def _extract_netloc(
            self,
            netloc: str,
            include_psl_private_domains: bool | None,
            session: requests.Session | None = None,
    Severity: Minor
    Found in tldextract/tldextract.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Minor
    Found in tldextract/tldextract.py - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status