SpamExperts/se-dns

View on GitHub

Showing 14 of 20 total issues

Function get_ns has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    def get_ns(self, domain, timeout=None):
        """Like query(domain, "NS"), but if the domain is a CNAME, then
        ask the domain's parent NS for the NS instead."""
        try:
            if self.failures[domain, "NS", "get_ns"]:
Severity: Minor
Found in se_dns/dnsutil.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 dnsutil.py has 279 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""A wrapper around dnspython.

The wrapper adds two sets of functionality.

Firstly, it provides a single cache object, whenever possible, that is
Severity: Minor
Found in se_dns/dnsutil.py - About 2 hrs to fix

    Function lookup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup(self, question, qtype="A", ctype="IN", exact=False):
            """Do an actual lookup.  'question' should be the hostname or IP to
            query, and 'qType' should be the type of record to get (e.g. TXT,
            A, AAAA, PTR)."""
            rdtype = dns.rdatatype.from_text(qtype)
    Severity: Minor
    Found in se_dns/dnsutil.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 lookup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup(self, question, qtype="A", ctype="IN", exact=False):
            """Do an actual lookup.  'question' should be the hostname or IP
            to query, and 'qType' should be the type of record to get
            (e.g. TXT, A, AAAA, PTR).
    
    
    Severity: Minor
    Found in se_dns/dnsutil.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

    Avoid too many return statements within this function.
    Open

                        return
    Severity: Major
    Found in se_dns/dnsutil.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return [i.to_text() for sublist in
      Severity: Major
      Found in se_dns/dnsutil.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return
        Severity: Major
        Found in se_dns/dnsutil.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return
          Severity: Major
          Found in se_dns/dnsutil.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return
            Severity: Major
            Found in se_dns/dnsutil.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return []
              Severity: Major
              Found in se_dns/dnsutil.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return [i.to_text()
                Severity: Major
                Found in se_dns/dnsutil.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return []
                  Severity: Major
                  Found in se_dns/dnsutil.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                        return
                    Severity: Major
                    Found in se_dns/dnsutil.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return
                      Severity: Major
                      Found in se_dns/dnsutil.py - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language