secynic/ipwhois

View on GitHub

Showing 100 of 266 total issues

Function bulk_lookup_rdap has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0,
Severity: Major
Found in ipwhois/experimental.py - About 1 hr to fix

Function lookup has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def lookup(self, inc_raw=False, retry_count=3, response=None,
Severity: Major
Found in ipwhois/whois.py - About 1 hr to fix

Function lookup has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def lookup(self, inc_raw=False, retry_count=3, asn_data=None, depth=0,
Severity: Major
Found in ipwhois/rdap.py - About 1 hr to fix

Function get_nets_other has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_nets_other(self, response):
        """
        The function for parsing network blocks from generic whois data.

        Args:
Severity: Minor
Found in ipwhois/whois.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 get_bulk_asn_whois has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_bulk_asn_whois(addresses=None, retry_count=3, timeout=120):
    """
    The function for retrieving ASN information for multiple IP addresses from
    Cymru via port 43/tcp (WHOIS).

Severity: Minor
Found in ipwhois/experimental.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 generate_output_asn has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_output_asn(self, json_data=None, hr=True, show_name=False,
                            colorize=True):
        """
        The function for generating CLI output ASN results.

Severity: Minor
Found in ipwhois/scripts/ipwhois_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 generate_output_entities has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_output_entities(self, json_data=None, hr=True,
                                 show_name=False, colorize=True):
        """
        The function for generating CLI output RDAP entity results.

Severity: Minor
Found in ipwhois/scripts/ipwhois_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 generate_output_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_output_list(self, source, key, val, line='2', hr=True,
                             show_name=False, colorize=True):
        """
        The function for generating CLI output RDAP list results.

Severity: Minor
Found in ipwhois/scripts/ipwhois_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 parse_fields has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def parse_fields(self, response, fields_dict, net_start=None,
Severity: Major
Found in ipwhois/nir.py - About 1 hr to fix

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

    def _get_entity(self, entity=None, roles=None, inc_raw=False, retry_count=3,
                    asn_data=None, bootstrap=False, rate_limit_timeout=120):
        """
        The function for retrieving and parsing information for an entity via
        RDAP (HTTP).
Severity: Minor
Found in ipwhois/rdap.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 unique_everseen has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def unique_everseen(iterable, key=None):
    """
    The generator to list unique elements, preserving the order. Remember all
    elements ever seen. This was taken from the itertools recipes.

Severity: Minor
Found in ipwhois/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 parse_fields_http has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def parse_fields_http(self, response, extra_org_map=None):
        """
        The function for parsing ASN fields from a http response.

        Args:
Severity: Minor
Found in ipwhois/asn.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 summarize_notices has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def summarize_notices(self, notices_json):
        """
        The function for summarizing RDAP notices in to a unique list.
        https://tools.ietf.org/html/rfc7483#section-4.3

Severity: Minor
Found in ipwhois/rdap.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(self):
        """
        The function for parsing the JSON response to the vars dictionary.
        """

Severity: Minor
Found in ipwhois/rdap.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 generate_output_list has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def generate_output_list(self, source, key, val, line='2', hr=True,
Severity: Major
Found in ipwhois/scripts/ipwhois_cli.py - About 50 mins to fix

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

    def generate_output_notices(self, source, key, val, line='1', hr=True,
Severity: Major
Found in ipwhois/scripts/ipwhois_cli.py - About 50 mins to fix

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

    def _get_entity(self, entity=None, roles=None, inc_raw=False, retry_count=3,
Severity: Major
Found in ipwhois/rdap.py - About 50 mins to fix

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

    def generate_output_events(self, source, key, val, line='2', hr=True,
Severity: Major
Found in ipwhois/scripts/ipwhois_cli.py - About 50 mins to fix

Avoid deeply nested control flow statements.
Open

                        if ip not in rated_lookups:

                            rated_lookups.append(ip)
                            stats[rir]['rate_limited'].append(ip)

Severity: Major
Found in ipwhois/experimental.py - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

                        if isinstance(val, str):

                            val = val.splitlines()

Severity: Major
Found in ipwhois/nir.py - About 45 mins to fix
Severity
Category
Status
Source
Language