saltstack/salt

View on GitHub
salt/modules/purefa.py

Summary

Maintainability
F
2 wks
Test Coverage

File purefa.py has 979 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

##
# Copyright 2017 Pure Storage Inc
#
Severity: Major
Found in salt/modules/purefa.py - About 2 days to fix

    Function pg_update has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
    Open

    def pg_update(name, hostgroup=None, host=None, volume=None):
        '''
    
        Update a protection group on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 1 day 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 pg_create has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
    Open

    def pg_create(name, hostgroup=None, host=None, volume=None, enabled=True):
        '''
    
        Create a protection group on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 1 day 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 hg_remove has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def hg_remove(name, volume=None, host=None):
        '''
    
        Remove a host and/or volume from a hostgroup on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 6 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 pg_remove has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def pg_remove(name, hostgroup=None, host=None, volume=None):
        '''
    
        Remove a hostgroup, host or volume from a protection group on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 4 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 hg_create has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def hg_create(name, host=None, volume=None):
        '''
    
        Create a hostgroup on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 3 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 hg_update has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def hg_update(name, host=None, volume=None):
        '''
    
        Adds entries to a hostgroup on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.py - About 3 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 host_create has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def host_create(name, iqn=None, wwn=None, nqn=None):
        '''
    
        Add a host on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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

    Cyclomatic complexity is too high in function pg_update. (26)
    Open

    def pg_update(name, hostgroup=None, host=None, volume=None):
        '''
    
        Update a protection group on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 host_update has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def host_update(name, iqn=None, wwn=None, nqn=None):
        '''
    
        Update a hosts port definitions on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 snap_volume_create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def snap_volume_create(name, target, overwrite=False):
        '''
    
        Create R/W volume from snapshot on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 volume_clone has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def volume_clone(name, target, overwrite=False):
        '''
    
        Clone an existing volume on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 volume_delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def volume_delete(name, eradicate=False):
        '''
    
        Delete a volume on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 pg_delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def pg_delete(name, eradicate=False):
        '''
    
        Delete a protecton group on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 snap_delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def snap_delete(name, suffix=None, eradicate=False):
        '''
    
        Delete a volume snapshot on a Pure Storage FlashArray.
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 host_delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def host_delete(name):
        '''
    
        Delete a host on a Pure Storage FlashArray (detaches all volumes).
    
    
    Severity: Minor
    Found in salt/modules/purefa.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 _get_system has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_system():
        '''
        Get Pure Storage FlashArray configuration
    
        1) From the minion config
    Severity: Minor
    Found in salt/modules/purefa.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 hg_delete has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def hg_delete(name):
        '''
    
        Delete a hostgroup on a Pure Storage FlashArray (removes all volumes and hosts).
    
    
    Severity: Minor
    Found in salt/modules/purefa.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

    Avoid deeply nested control flow statements.
    Open

                        if temp['vol'] == volume:
                            try:
                                array.disconnect_hgroup(name, volume)
                                return True
                            except purestorage.PureError:
    Severity: Major
    Found in salt/modules/purefa.py - About 45 mins to fix

      Function volume_extend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def volume_extend(name, size):
          '''
      
          Extend an existing volume on a Pure Storage FlashArray.
      
      
      Severity: Minor
      Found in salt/modules/purefa.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

      Avoid deeply nested control flow statements.
      Open

                          if _get_hgroup(hostgroup, array) is not None:
                              try:
                                  array.set_pgroup(name, addhgrouplist=[hostgroup])
                                  return True
                              except purestorage.PureError:
      Severity: Major
      Found in salt/modules/purefa.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if _get_host(host, array) is not None:
                                try:
                                    array.set_pgroup(name, addhostlist=[host])
                                    return True
                                except purestorage.PureError:
        Severity: Major
        Found in salt/modules/purefa.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if _get_volume(volume, array) is not None:
                                  try:
                                      array.set_pgroup(name, addvollist=[volume])
                                      return True
                                  except purestorage.PureError:
          Severity: Major
          Found in salt/modules/purefa.py - About 45 mins to fix

            Function volume_create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def volume_create(name, size=None):
                '''
            
                Create a volume on a Pure Storage FlashArray.
            
            
            Severity: Minor
            Found in salt/modules/purefa.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 False
            Severity: Major
            Found in salt/modules/purefa.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

                                return True
                            Severity: Major
                            Found in salt/modules/purefa.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

                                                          return True
                                  Severity: Major
                                  Found in salt/modules/purefa.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return True
                                    Severity: Major
                                    Found in salt/modules/purefa.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

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

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                Avoid too many return statements within this function.
                                                Open

                                                        return True
                                                Severity: Major
                                                Found in salt/modules/purefa.py - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

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

                                                    Avoid too many return statements within this function.
                                                    Open

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

                                                      Avoid too many return statements within this function.
                                                      Open

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

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                                    return True
                                                        Severity: Major
                                                        Found in salt/modules/purefa.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

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

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                                          return True
                                                              Severity: Major
                                                              Found in salt/modules/purefa.py - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

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

                                                                  Avoid too many return statements within this function.
                                                                  Open

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

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                              return True
                                                                      Severity: Major
                                                                      Found in salt/modules/purefa.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                                    return True
                                                                        Severity: Major
                                                                        Found in salt/modules/purefa.py - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

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

                                                                            Avoid too many return statements within this function.
                                                                            Open

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

                                                                              Avoid too many return statements within this function.
                                                                              Open

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

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                    return True
                                                                                Severity: Major
                                                                                Found in salt/modules/purefa.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

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

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

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

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

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

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                                      return True
                                                                                              Severity: Major
                                                                                              Found in salt/modules/purefa.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

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

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

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

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                                        return True
                                                                                                    Severity: Major
                                                                                                    Found in salt/modules/purefa.py - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

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

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

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

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

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

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

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

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

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

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

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

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

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

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                                            return True
                                                                                                                    Severity: Major
                                                                                                                    Found in salt/modules/purefa.py - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

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

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

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

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

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

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

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

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

                                                                                                                              def volume_detach(name, host):
                                                                                                                                  '''
                                                                                                                              
                                                                                                                                  Detach a volume from a host on a Pure Storage FlashArray.
                                                                                                                              
                                                                                                                              
                                                                                                                              Severity: Minor
                                                                                                                              Found in salt/modules/purefa.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 pg_delete(name, eradicate=False):
                                                                                                                                  '''
                                                                                                                              
                                                                                                                                  Delete a protecton group on a Pure Storage FlashArray.
                                                                                                                              
                                                                                                                              
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 5 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 356..392

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

                                                                                                                              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 volume_delete(name, eradicate=False):
                                                                                                                                  '''
                                                                                                                              
                                                                                                                                  Delete a volume on a Pure Storage FlashArray.
                                                                                                                              
                                                                                                                              
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 5 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 1146..1180

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

                                                                                                                              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

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

                                                                                                                                  if _get_volume(name, array) is not None:
                                                                                                                                      if _get_volume(target, array) is None:
                                                                                                                                          try:
                                                                                                                                              array.copy_volume(name, target)
                                                                                                                                              return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 4 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 488..503

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

                                                                                                                              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

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

                                                                                                                                  if _get_snapshot(source, suffix, array) is not None:
                                                                                                                                      if _get_volume(target, array) is None:
                                                                                                                                          try:
                                                                                                                                              array.copy_volume(name, target)
                                                                                                                                              return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 4 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 533..548

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

                                                                                                                              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

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

                                                                                                                                  if suffix is None:
                                                                                                                                      suffix = 'snap-' + six.text_type((datetime.utcnow() - datetime(1970, 1, 1, 0, 0, 0, 0)).total_seconds())
                                                                                                                                      suffix = suffix.replace('.', '')
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 3 hrs to fix
                                                                                                                              salt/modules/purefb.py on lines 189..193

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

                                                                                                                              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

                                                                                                                                          elif volume is not None:
                                                                                                                                              if _get_volume(volume, array) is not None:
                                                                                                                                                  try:
                                                                                                                                                      array.set_pgroup(name, addvollist=[volume])
                                                                                                                                                      return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 2 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 1014..1024
                                                                                                                              salt/modules/purefa.py on lines 1025..1035

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

                                                                                                                              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 hostgroup is not None:
                                                                                                                                              if _get_hgroup(hostgroup, array) is not None:
                                                                                                                                                  try:
                                                                                                                                                      array.set_pgroup(name, addhgrouplist=[hostgroup])
                                                                                                                                                      return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 2 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 1025..1035
                                                                                                                              salt/modules/purefa.py on lines 1036..1046

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

                                                                                                                              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

                                                                                                                                          elif host is not None:
                                                                                                                                              if _get_host(host, array) is not None:
                                                                                                                                                  try:
                                                                                                                                                      array.set_pgroup(name, addhostlist=[host])
                                                                                                                                                      return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 2 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 1014..1024
                                                                                                                              salt/modules/purefa.py on lines 1036..1046

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

                                                                                                                              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 pg_eradicate(name):
                                                                                                                                  '''
                                                                                                                              
                                                                                                                                  Eradicate a deleted protecton group on a Pure Storage FlashArray.
                                                                                                                              
                                                                                                                              
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 2 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 395..422

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

                                                                                                                              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 volume_eradicate(name):
                                                                                                                                  '''
                                                                                                                              
                                                                                                                                  Eradicate a deleted volume on a Pure Storage FlashArray.
                                                                                                                              
                                                                                                                              
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 2 hrs to fix
                                                                                                                              salt/modules/purefa.py on lines 1183..1210

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

                                                                                                                              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

                                                                                                                              def _get_host(name, array):
                                                                                                                                  '''Private function to check host'''
                                                                                                                                  host = None
                                                                                                                                  for temp in array.list_hosts():
                                                                                                                                      if temp['name'] == name:
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 169..176
                                                                                                                              salt/modules/purefa.py on lines 187..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 50.

                                                                                                                              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

                                                                                                                              def _get_hgroup(name, array):
                                                                                                                                  '''Private function to check hostgroup'''
                                                                                                                                  hostgroup = None
                                                                                                                                  for temp in array.list_hgroups():
                                                                                                                                      if temp['name'] == name:
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 169..176
                                                                                                                              salt/modules/purefa.py on lines 197..204

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

                                                                                                                              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

                                                                                                                              def _get_pgroup(name, array):
                                                                                                                                  '''Private function to check protection group'''
                                                                                                                                  pgroup = None
                                                                                                                                  for temp in array.list_pgroups():
                                                                                                                                      if temp['name'] == name:
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 187..194
                                                                                                                              salt/modules/purefa.py on lines 197..204

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

                                                                                                                              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

                                                                                                                                              elif volume is not None:
                                                                                                                                                  if _get_volume(volume, array) is not None:
                                                                                                                                                      try:
                                                                                                                                                          array.set_pgroup(name, addvollist=[volume])
                                                                                                                                                          return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 1113..1121
                                                                                                                              salt/modules/purefa.py on lines 1122..1130

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

                                                                                                                              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

                                                                                                                                              elif host is not None:
                                                                                                                                                  if _get_host(host, array) is not None:
                                                                                                                                                      try:
                                                                                                                                                          array.set_pgroup(name, addhostlist=[host])
                                                                                                                                                          return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 1113..1121
                                                                                                                              salt/modules/purefa.py on lines 1131..1139

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

                                                                                                                              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 hostgroup is not None:
                                                                                                                                                  if _get_hgroup(hostgroup, array) is not None:
                                                                                                                                                      try:
                                                                                                                                                          array.set_pgroup(name, addhgrouplist=[hostgroup])
                                                                                                                                                          return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 1122..1130
                                                                                                                              salt/modules/purefa.py on lines 1131..1139

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

                                                                                                                              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 nqn is not None:
                                                                                                                                          try:
                                                                                                                                              array.set_host(name, addnqnlist=[nqn])
                                                                                                                                          except purestorage.PureError:
                                                                                                                                              array.delete_host(name)
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 659..664
                                                                                                                              salt/modules/purefa.py on lines 665..670

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

                                                                                                                              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 iqn is not None:
                                                                                                                                          try:
                                                                                                                                              array.set_host(name, addiqnlist=[iqn])
                                                                                                                                          except purestorage.PureError:
                                                                                                                                              array.delete_host(name)
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 653..658
                                                                                                                              salt/modules/purefa.py on lines 665..670

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

                                                                                                                              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 wwn is not None:
                                                                                                                                          try:
                                                                                                                                              array.set_host(name, addwwnlist=[wwn])
                                                                                                                                          except purestorage.PureError:
                                                                                                                                              array.delete_host(name)
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 2 other locations - About 1 hr to fix
                                                                                                                              salt/modules/purefa.py on lines 653..658
                                                                                                                              salt/modules/purefa.py on lines 659..664

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      elif host is not None and pgroup['hosts'] is not None:
                                                                                                                                          if _get_host(host, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.add_host(host, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1084..1092
                                                                                                                              salt/modules/purefa.py on lines 1102..1110
                                                                                                                              salt/modules/purefa.py on lines 1243..1251
                                                                                                                              salt/modules/purefa.py on lines 1252..1260
                                                                                                                              salt/modules/purefa.py on lines 1261..1269

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      elif host is not None and pgroup['hosts'] is not None:
                                                                                                                                          if _get_host(host, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.remove_host(host, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1084..1092
                                                                                                                              salt/modules/purefa.py on lines 1093..1101
                                                                                                                              salt/modules/purefa.py on lines 1102..1110
                                                                                                                              salt/modules/purefa.py on lines 1243..1251
                                                                                                                              salt/modules/purefa.py on lines 1261..1269

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      elif volume is not None and pgroup['volumes'] is not None:
                                                                                                                                          if _get_volume(volume, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.add_volume(volume, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1084..1092
                                                                                                                              salt/modules/purefa.py on lines 1093..1101
                                                                                                                              salt/modules/purefa.py on lines 1243..1251
                                                                                                                              salt/modules/purefa.py on lines 1252..1260
                                                                                                                              salt/modules/purefa.py on lines 1261..1269

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      elif volume is not None and pgroup['volumes'] is not None:
                                                                                                                                          if _get_volume(volume, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.remove_volume(volume, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1084..1092
                                                                                                                              salt/modules/purefa.py on lines 1093..1101
                                                                                                                              salt/modules/purefa.py on lines 1102..1110
                                                                                                                              salt/modules/purefa.py on lines 1243..1251
                                                                                                                              salt/modules/purefa.py on lines 1252..1260

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      if hostgroup is not None and pgroup['hgroups'] is not None:
                                                                                                                                          if _get_hgroup(hostgroup, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.remove_hgroup(hostgroup, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1084..1092
                                                                                                                              salt/modules/purefa.py on lines 1093..1101
                                                                                                                              salt/modules/purefa.py on lines 1102..1110
                                                                                                                              salt/modules/purefa.py on lines 1252..1260
                                                                                                                              salt/modules/purefa.py on lines 1261..1269

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

                                                                                                                              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 6 locations. Consider refactoring.
                                                                                                                              Open

                                                                                                                                      if hostgroup is not None and pgroup['hgroups'] is not None:
                                                                                                                                          if _get_hgroup(hostgroup, array) is not None:
                                                                                                                                              try:
                                                                                                                                                  array.add_hgroup(hostgroup, name)
                                                                                                                                                  return True
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/modules/purefa.py and 5 other locations - About 50 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 1093..1101
                                                                                                                              salt/modules/purefa.py on lines 1102..1110
                                                                                                                              salt/modules/purefa.py on lines 1243..1251
                                                                                                                              salt/modules/purefa.py on lines 1252..1260
                                                                                                                              salt/modules/purefa.py on lines 1261..1269

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

                                                                                                                              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

                                                                                                                                      for vol in array.list_hgroup_connections(name):
                                                                                                                                          try:
                                                                                                                                              array.disconnect_hgroup(name, vol['vol'])
                                                                                                                                          except purestorage.PureError:
                                                                                                                                              return False
                                                                                                                              Severity: Minor
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 30 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 747..751

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

                                                                                                                              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 pgroup['hgroups'] is None and pgroup['hosts'] is None and pgroup['volumes'] is None:
                                                                                                                              Severity: Minor
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 30 mins to fix
                                                                                                                              salt/utils/nxos.py on lines 114..116

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

                                                                                                                              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

                                                                                                                                      for vol in array.list_host_connections(name):
                                                                                                                                          try:
                                                                                                                                              array.disconnect_host(name, vol['vol'])
                                                                                                                                          except purestorage.PureError:
                                                                                                                                              return False
                                                                                                                              Severity: Minor
                                                                                                                              Found in salt/modules/purefa.py and 1 other location - About 30 mins to fix
                                                                                                                              salt/modules/purefa.py on lines 885..889

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

                                                                                                                              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