saltstack/salt

View on GitHub
salt/ext/ipaddress.py

Summary

Maintainability
F
2 wks
Test Coverage

File ipaddress.py has 1677 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
Python 2.[67] port of Python 3.4's ipaddress module

Almost verbatim copy of the core lib, with compatibility changes
Source: https://bitbucket.org/kwi/py2-ipaddress/
Severity: Major
Found in salt/ext/ipaddress.py - About 4 days to fix

    Function _ip_int_from_string has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

        def _ip_int_from_string(self, ip_str):
            """Turn an IPv6 ip_str into an integer.
    
            Args:
                ip_str: A string, the IPv6 ip_str.
    Severity: Minor
    Found in salt/ext/ipaddress.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

    _BaseNetwork has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class _BaseNetwork(_IPAddressBase):
    
        """A generic IP network object.
    
        This IP class contains the version independent methods which are
    Severity: Minor
    Found in salt/ext/ipaddress.py - About 3 hrs to fix

      Function collapse_addresses has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def collapse_addresses(addresses):
          """Collapse a list of IP objects.
      
          Example:
              collapse_addresses([IPv4Network('192.0.2.0/25'),
      Severity: Minor
      Found in salt/ext/ipaddress.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 _compress_hextets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _compress_hextets(self, hextets):
              """Compresses a list of hextets.
      
              Compresses a list of strings, replacing the longest continuous
              sequence of "0" in the list with "" and adding empty strings at
      Severity: Minor
      Found in salt/ext/ipaddress.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 address_exclude has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def address_exclude(self, other):
              """Remove an address from a larger block.
      
              For example:
      
      
      Severity: Minor
      Found in salt/ext/ipaddress.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

      Cyclomatic complexity is too high in method _ip_int_from_string. (21)
      Open

          def _ip_int_from_string(self, ip_str):
              """Turn an IPv6 ip_str into an integer.
      
              Args:
                  ip_str: A string, the IPv6 ip_str.
      Severity: Minor
      Found in salt/ext/ipaddress.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function _is_valid_netmask has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _is_valid_netmask(self, netmask):
              """Verify that the netmask is valid.
      
              Args:
                  netmask: A string, either a prefix or dotted decimal
      Severity: Minor
      Found in salt/ext/ipaddress.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 _collapse_addresses_recursive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def _collapse_addresses_recursive(addresses):
          """Loops through the addresses, collapsing concurrent netblocks.
      
          Example:
      
      
      Severity: Minor
      Found in salt/ext/ipaddress.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 subnets has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def subnets(self, prefixlen_diff=1, new_prefix=None):
              """The subnets which join to make the current subnet.
      
              In the case that self contains only one IP
              (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
      Severity: Minor
      Found in salt/ext/ipaddress.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 summarize_address_range has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def summarize_address_range(first, last):
          """Summarize a network range given the first and last IP addresses.
      
          Example:
              >>> list(summarize_address_range(IPv4Address('192.0.2.0'),
      Severity: Minor
      Found in salt/ext/ipaddress.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, address, strict=True):
      
              """Instantiate a new IPv4 network object.
      
              Args:
      Severity: Minor
      Found in salt/ext/ipaddress.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, address, strict=True):
              """Instantiate a new IPv6 Network object.
      
              Args:
                  address: A string or integer representing the IPv6 network or the
      Severity: Minor
      Found in salt/ext/ipaddress.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 supernet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def supernet(self, prefixlen_diff=1, new_prefix=None):
              """The supernet containing the current network.
      
              Args:
                  prefixlen_diff: An integer, the amount the prefix length of
      Severity: Minor
      Found in salt/ext/ipaddress.py - About 35 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

      Avoid too many return statements within this function.
      Open

              return 0
      Severity: Major
      Found in salt/ext/ipaddress.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 0 <= netmask <= self._max_prefixlen
        Severity: Major
        Found in salt/ext/ipaddress.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return False
          Severity: Major
          Found in salt/ext/ipaddress.py - About 30 mins to fix

            Function __getitem__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def __getitem__(self, n):
                    network = int(self.network_address)
                    broadcast = int(self.broadcast_address)
                    if n >= 0:
                        if network + n > broadcast:
            Severity: Minor
            Found in salt/ext/ipaddress.py - About 25 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_octet has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _parse_octet(self, octet_str):
                    """Convert a decimal octet into an integer.
            
                    Args:
                        octet_str: A string, the number to parse.
            Severity: Minor
            Found in salt/ext/ipaddress.py - About 25 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __init__(self, address):
                    if isinstance(address, (bytes, int)):
                        IPv6Address.__init__(self, address)
                        self.network = IPv6Network(self._ip)
                        self._prefixlen = self._max_prefixlen
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 7 hrs to fix
            salt/ext/ipaddress.py on lines 1460..1474

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 125.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __init__(self, address):
                    if isinstance(address, (bytes, int)):
                        IPv4Address.__init__(self, address)
                        self.network = IPv4Network(self._ip)
                        self._prefixlen = self._max_prefixlen
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 7 hrs to fix
            salt/ext/ipaddress.py on lines 2100..2112

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 125.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __init__(self, address):
                    """Instantiate a new IPv6 address object.
            
                    Args:
                        address: A string or integer representing the IP
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 6 hrs to fix
            salt/ext/ipaddress.py on lines 1333..1367

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 110.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __init__(self, address):
            
                    """
                    Args:
                        address: A string or integer representing the IP
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 6 hrs to fix
            salt/ext/ipaddress.py on lines 1903..1938

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 110.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __eq__(self, other):
                    address_equal = IPv4Address.__eq__(self, other)
                    if not address_equal or address_equal is NotImplemented:
                        return address_equal
                    try:
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 2 hrs to fix
            salt/ext/ipaddress.py on lines 2118..2128

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __eq__(self, other):
                    address_equal = IPv6Address.__eq__(self, other)
                    if not address_equal or address_equal is NotImplemented:
                        return address_equal
                    try:
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 2 hrs to fix
            salt/ext/ipaddress.py on lines 1480..1490

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 64.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            def ip_interface(address):
                """Take an IP string/int and return an object of the correct type.
            
                Args:
                    address: A string or integer, the IP address.  Either IPv4 or
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 2 hrs to fix
            salt/ext/ipaddress.py on lines 103..129

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            def ip_address(address):
                """Take an IP string/int and return an object of the correct type.
            
                Args:
                    address: A string or integer, the IP address.  Either IPv4 or
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 2 hrs to fix
            salt/ext/ipaddress.py on lines 163..194

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 58.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __lt__(self, other):
                    address_less = IPv4Address.__lt__(self, other)
                    if address_less is NotImplemented:
                        return NotImplemented
                    try:
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 1 hr to fix
            salt/ext/ipaddress.py on lines 2130..2139

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 55.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                def __lt__(self, other):
                    address_less = IPv6Address.__lt__(self, other)
                    if address_less is NotImplemented:
                        return NotImplemented
                    try:
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 1 hr to fix
            salt/ext/ipaddress.py on lines 1492..1501

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 55.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    if strict:
                        if (IPv6Address(int(self.network_address) & int(self.netmask)) !=
                            self.network_address):
                            raise ValueError('%s has host bits set' % self)
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 1 hr to fix
            salt/ext/ipaddress.py on lines 1615..1618

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                    if strict:
                        if (IPv4Address(int(self.network_address) & int(self.netmask)) !=
                            self.network_address):
                            raise ValueError('%s has host bits set' % self)
            Severity: Major
            Found in salt/ext/ipaddress.py and 1 other location - About 1 hr to fix
            salt/ext/ipaddress.py on lines 2250..2253

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                        if ips and ips[-1]._version != ip._version:
                            raise TypeError("%s and %s are not of the same version" % (
                                             ip, ips[-1]))
            Severity: Major
            Found in salt/ext/ipaddress.py and 2 other locations - About 1 hr to fix
            salt/ext/ipaddress.py on lines 416..418
            salt/ext/ipaddress.py on lines 424..426

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                        if nets and nets[-1]._version != ip._version:
                            raise TypeError("%s and %s are not of the same version" % (
                                             ip, nets[-1]))
            Severity: Major
            Found in salt/ext/ipaddress.py and 2 other locations - About 1 hr to fix
            salt/ext/ipaddress.py on lines 411..413
            salt/ext/ipaddress.py on lines 416..418

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                        if ips and ips[-1]._version != ip._version:
                            raise TypeError("%s and %s are not of the same version" % (
                                             ip, ips[-1]))
            Severity: Major
            Found in salt/ext/ipaddress.py and 2 other locations - About 1 hr to fix
            salt/ext/ipaddress.py on lines 411..413
            salt/ext/ipaddress.py on lines 424..426

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 47.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                    if isinstance(address, bytes):
                        self.network_address = IPv6Address(address)
                        self._prefixlen = self._max_prefixlen
                        self.netmask = IPv6Address(self._ALL_ONES)
                        return
            Severity: Major
            Found in salt/ext/ipaddress.py and 3 other locations - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1583..1588
            salt/ext/ipaddress.py on lines 1591..1596
            salt/ext/ipaddress.py on lines 2224..2228

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                    if isinstance(address, int):
                        self.network_address = IPv6Address(address)
                        self._prefixlen = self._max_prefixlen
                        self.netmask = IPv6Address(self._ALL_ONES)
                        return
            Severity: Major
            Found in salt/ext/ipaddress.py and 3 other locations - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1583..1588
            salt/ext/ipaddress.py on lines 1591..1596
            salt/ext/ipaddress.py on lines 2231..2235

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                    if isinstance(address, bytes):
                        self.network_address = IPv4Address(address)
                        self._prefixlen = self._max_prefixlen
                        self.netmask = IPv4Address(self._ALL_ONES)
                        #fixme: address/network test here
            Severity: Major
            Found in salt/ext/ipaddress.py and 3 other locations - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1591..1596
            salt/ext/ipaddress.py on lines 2224..2228
            salt/ext/ipaddress.py on lines 2231..2235

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 4 locations. Consider refactoring.
            Open

                    if isinstance(address, int):
                        self.network_address = IPv4Address(address)
                        self._prefixlen = self._max_prefixlen
                        self.netmask = IPv4Address(self._ALL_ONES)
                        #fixme: address/network test here.
            Severity: Major
            Found in salt/ext/ipaddress.py and 3 other locations - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1583..1588
            salt/ext/ipaddress.py on lines 2224..2228
            salt/ext/ipaddress.py on lines 2231..2235

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if not parts[-1]:
                            parts_lo -= 1
                            if parts_lo:
                                msg = "Trailing ':' only permitted as part of '::' in %r"
                                raise AddressValueError(msg % ip_str)  # :$ requires ::$
            Severity: Minor
            Found in salt/ext/ipaddress.py and 1 other location - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1715..1719

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                        if not parts[0]:
                            parts_hi -= 1
                            if parts_hi:
                                msg = "Leading ':' only permitted as part of '::' in %r"
                                raise AddressValueError(msg % ip_str)  # ^: requires ^::
            Severity: Minor
            Found in salt/ext/ipaddress.py and 1 other location - About 45 mins to fix
            salt/ext/ipaddress.py on lines 1720..1724

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 43.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            There are no issues that match your filters.

            Category
            Status