Arubacloud/pyArubaCloud

View on GitHub

Showing 94 of 94 total issues

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

    def reset(self, addresses):
        """
        Remove all PTR records from the given address
        :type addresses: List[str]
        :param addresses: (List[str]) The IP Address to reset
Severity: Major
Found in ArubaCloud/ReverseDns/ReverseDns.py and 1 other location - About 1 hr to fix
ArubaCloud/ReverseDns/ReverseDns.py on lines 12..21

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 45.

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

        try:
            self.json_msg['Server']['VirtualDisks'].append(virtual_disk)
            self.virtual_disk_counter += 1
            return True
        except KeyError:
Severity: Major
Found in ArubaCloud/objects/__init__.py and 2 other locations - About 1 hr to fix
ArubaCloud/objects/__init__.py on lines 71..76
ArubaCloud/objects/__init__.py on lines 90..95

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 45.

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 get(self, addresses):
        """
        :type addresses: list[str]
        :param addresses: (list[str]) List of addresses to retrieve their reverse dns
        Retrieve the current configured ReverseDns entries
Severity: Major
Found in ArubaCloud/ReverseDns/ReverseDns.py and 1 other location - About 1 hr to fix
ArubaCloud/ReverseDns/ReverseDns.py on lines 36..45

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 45.

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

        try:
            self.json_msg['Server']['NetworkAdaptersConfiguration'].append(network_adapter)
            self.ethernet_counter += 1
            return True
        except KeyError:
Severity: Major
Found in ArubaCloud/objects/__init__.py and 2 other locations - About 1 hr to fix
ArubaCloud/objects/__init__.py on lines 90..95
ArubaCloud/objects/__init__.py on lines 106..111

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 45.

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

ArubaCloud/SharedStorage/Requests/GetSharedStorages.py on lines 0..9

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

Function find_ip has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def find_ip(self, ip):
        f = None
        if ip.__class__ is 'base.Ip.Ip':
            # logger.debug('DEBUG: matched IP Object: %s' % ip.__class__)
            pattern = ip.ip_addr
Severity: Minor
Found in ArubaCloud/base/vm.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

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

Severity: Major
Found in ArubaCloud/SharedStorage/Requests/GetSharedStorages.py and 1 other location - About 1 hr to fix
ArubaCloud/Compute/LoadBalancer/Requests/GetLoadBalancers.py on lines 0..9

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

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

    def create(self, healthCheckNotification, instance, ipAddressResourceId, name, notificationContacts, rules,
Severity: Major
Found in ArubaCloud/Compute/LoadBalancer/LoadBalancer.py - About 1 hr to fix

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

        def __init__(self, healthCheckNotification, instance, ipAddressResourceId, loadBalancerClassOfServiceID, name,

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

          def find_job(self, vm_name):
              jobs_list = self.get_jobs()
              if jobs_list['Value'] is None:
                  _i = 0
                  while jobs_list['Value'] is not None:
      Severity: Minor
      Found in ArubaCloud/PyArubaAPI.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 find has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def find(self, vm_name=None, ip_addr=None, resid=None):
              # more defensive checks, just to have fun...
              params = locals()
              pattern = {}
              ip = None
      Severity: Minor
      Found in ArubaCloud/objects/__init__.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

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

          def __str__(self):
              msg = super(Smart, self).__str__()
              msg += ' -> IPAddr: %s\n' % self.ip_addr
              return msg
      Severity: Major
      Found in ArubaCloud/objects/VmTypes/__init__.py and 1 other location - About 1 hr to fix
      ArubaCloud/objects/VmTypes/__init__.py on lines 163..166

      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 38.

      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 __str__(self):
              msg = super(Pro, self).__str__()
              msg += ' -> IPAddr: %s\n' % self.ip_addr
              return msg
      Severity: Major
      Found in ArubaCloud/objects/VmTypes/__init__.py and 1 other location - About 1 hr to fix
      ArubaCloud/objects/VmTypes/__init__.py on lines 15..18

      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 38.

      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

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

          def __init__(self, name, serverid, operationtype, start, end, DC, auth_obj):
      Severity: Major
      Found in ArubaCloud/objects/Scheduled.py - About 50 mins to fix

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

            def __init__(self, logger=None, Username=str(), Password=str(), SessionId=None, ApplicationId=None, RequestId=None,
        Severity: Major
        Found in ArubaCloud/base/__init__.py - About 50 mins to fix

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

              def __init__(self, balancerType, certificate, creationDate, id, instancePort, loadBalancerPort, protocol):
          Severity: Major
          Found in ArubaCloud/Compute/LoadBalancer/Models/NewLoadBalancerRule.py - About 50 mins to fix

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

                def test_get_shared_storage(self):
                    response = self.sharedStorage.get()
                    self.assertIsNotNone(response)
                    self.assertIsInstance(response, list)
            Severity: Minor
            Found in test/SharedStorage.py and 1 other location - About 50 mins to fix
            test/LoadBalancer.py on lines 13..16

            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 36.

            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 test_get(self):
                    response = self.loadBalancer.get()
                    self.assertIsNotNone(response)
                    self.assertIsInstance(response, list)
            Severity: Minor
            Found in test/LoadBalancer.py and 1 other location - About 50 mins to fix
            test/SharedStorage.py on lines 16..19

            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 36.

            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

            Avoid deeply nested control flow statements.
            Open

                                    if resource_type == 1:
                                        o.resource_bounds.max_cpu = rb['Max']
                                    if resource_type == 2:
            Severity: Major
            Found in ArubaCloud/PyArubaAPI.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if resource_type == 8:
                                          o.resource_bounds.hdd2 = rb['Max']
                                      if resource_type == 9:
              Severity: Major
              Found in ArubaCloud/PyArubaAPI.py - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language