saltstack/salt

View on GitHub
salt/states/boto3_elasticache.py

Summary

Maintainability
F
3 wks
Test Coverage

File boto3_elasticache.py has 1070 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage Elasticache with boto3
=============================

Severity: Major
Found in salt/states/boto3_elasticache.py - About 2 days to fix

    Function replication_group_present has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def replication_group_present(name, wait=900, security_groups=None, region=None, key=None,
                                  keyid=None, profile=None, **args):
        '''
        Ensure a replication group exists and is in the given state.
    
    
    Severity: Minor
    Found in salt/states/boto3_elasticache.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function cache_parameter_group_present has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    def cache_parameter_group_present(name, region=None, key=None, keyid=None, profile=None, **args):
        '''
        Ensure cache parameter group exists.
    
        name
    Severity: Minor
    Found in salt/states/boto3_elasticache.py - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function cache_cluster_present has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def cache_cluster_present(name, wait=900, security_groups=None, region=None, key=None,
                              keyid=None, profile=None, **args):
        '''
        Ensure a given cache cluster exists.
    
    
    Severity: Minor
    Found in salt/states/boto3_elasticache.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 _diff_cache_cluster has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def _diff_cache_cluster(current, desired):
        '''
        If you need to enhance what modify_cache_cluster() considers when deciding what is to be
        (or can be) updated, add it to 'modifiable' below.  It's a dict mapping the param as used
        in modify_cache_cluster() to that in describe_cache_clusters().  Any data fiddlery that
    Severity: Minor
    Found in salt/states/boto3_elasticache.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 _diff_replication_group has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _diff_replication_group(current, desired):
        '''
        If you need to enhance what modify_replication_group() considers when deciding what is to be
        (or can be) updated, add it to 'modifiable' below.  It's a dict mapping the param as used
        in modify_replication_group() to that in describe_replication_groups().  Any data fiddlery
    Severity: Minor
    Found in salt/states/boto3_elasticache.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 cache_subnet_group_present has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def cache_subnet_group_present(name, subnets=None, region=None, key=None, keyid=None, profile=None,
                                   **args):
        '''
        Ensure cache subnet group exists.
    
    
    Severity: Minor
    Found in salt/states/boto3_elasticache.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 _diff_cache_subnet_group has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _diff_cache_subnet_group(current, desired):
        '''
        If you need to enhance what modify_cache_subnet_group() considers when deciding what is to be
        (or can be) updated, add it to 'modifiable' below.  It's a dict mapping the param as used
        in modify_cache_subnet_group() to that in describe_cache_subnet_group().  Any data fiddlery that
    Severity: Minor
    Found in salt/states/boto3_elasticache.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

    Avoid deeply nested control flow statements.
    Open

                        if current[m] != desired[m]:
                            need_update[m] = desired[m]
        return need_update
    Severity: Major
    Found in salt/states/boto3_elasticache.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if current[m] != desired[m]:
                              need_update[m] = desired[m]
          return need_update
      Severity: Major
      Found in salt/states/boto3_elasticache.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if current[m] != desired[m]:
                                need_update[m] = desired[m]
            return need_update
        Severity: Major
        Found in salt/states/boto3_elasticache.py - About 45 mins to fix

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

          def cache_subnet_group_absent(name, region=None, key=None, keyid=None, profile=None, **args):
              '''
              Ensure a given cache subnet group is deleted.
          
              name
          Severity: Minor
          Found in salt/states/boto3_elasticache.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

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

          def replication_group_absent(name, wait=600, region=None, key=None, keyid=None,
                                       profile=None, **args):
              '''
              Ensure a given replication group is deleted.
          
          
          Severity: Minor
          Found in salt/states/boto3_elasticache.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

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

          def cache_cluster_absent(name, wait=600, region=None, key=None, keyid=None,
                                   profile=None, **args):
              '''
              Ensure a given cache cluster is deleted.
          
          
          Severity: Minor
          Found in salt/states/boto3_elasticache.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

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

          def cache_parameter_group_absent(name, region=None, key=None, keyid=None, profile=None, **args):
              '''
              Ensure a given cache parameter group is absent.
          
              name
          Severity: Minor
          Found in salt/states/boto3_elasticache.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 ret
          Severity: Major
          Found in salt/states/boto3_elasticache.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return ret
            Severity: Major
            Found in salt/states/boto3_elasticache.py - About 30 mins to fix

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

              def cache_cluster_absent(name, wait=600, region=None, key=None, keyid=None,
                                       profile=None, **args):
                  '''
                  Ensure a given cache cluster is deleted.
              
              
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 2 days to fix
              salt/states/boto3_elasticache.py on lines 916..978

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

              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 replication_group_absent(name, wait=600, region=None, key=None, keyid=None,
                                           profile=None, **args):
                  '''
                  Ensure a given replication group is deleted.
              
              
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 2 days to fix
              salt/states/boto3_elasticache.py on lines 487..545

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

              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 cache_subnet_group_absent(name, region=None, key=None, keyid=None, profile=None, **args):
                  '''
                  Ensure a given cache subnet group is deleted.
              
                  name
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 2 days to fix
              salt/states/boto3_elasticache.py on lines 1280..1323

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

              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 cache_parameter_group_absent(name, region=None, key=None, keyid=None, profile=None, **args):
                  '''
                  Ensure a given cache parameter group is absent.
              
                  name
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 2 days to fix
              salt/states/boto3_elasticache.py on lines 1104..1149

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

              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 created:
                          new = __salt__['boto3_elasticache.'
                                         'describe_replication_groups'](name, region=region, key=key,
                                                                        keyid=keyid, profile=profile)
                          ret['comment'] = 'Replication group {0} was created.'.format(name)
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 7 hrs to fix
              salt/states/boto3_elasticache.py on lines 442..451
              salt/states/boto3_elasticache.py on lines 1067..1076

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

              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 created:
                          new = __salt__['boto3_elasticache.'
                                         'describe_cache_subnet_groups'](name, region=region, key=key,
                                                                         keyid=keyid, profile=profile)
                          ret['comment'] = 'Cache subnet group {0} was created.'.format(name)
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 7 hrs to fix
              salt/states/boto3_elasticache.py on lines 442..451
              salt/states/boto3_elasticache.py on lines 871..880

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

              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 created:
                          new = __salt__['boto3_elasticache.'
                                         'describe_cache_clusters'](name, region=region, key=key,
                                                                    keyid=keyid, profile=profile)
                          ret['comment'] = 'Cache cluster {0} was created.'.format(name)
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 7 hrs to fix
              salt/states/boto3_elasticache.py on lines 871..880
              salt/states/boto3_elasticache.py on lines 1067..1076

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

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

                  for m, o in modifiable.items():
                      if m in desired:
                          if not o:
                              # Always pass these through - let AWS do the math...
                              need_update[m] = desired[m]
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 6 hrs to fix
              salt/states/boto3_elasticache.py on lines 587..597
              salt/states/boto3_elasticache.py on lines 1000..1010

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

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

                  for m, o in modifiable.items():
                      if m in desired:
                          if not o:
                              # Always pass these through - let AWS do the math...
                              need_update[m] = desired[m]
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 6 hrs to fix
              salt/states/boto3_elasticache.py on lines 150..160
              salt/states/boto3_elasticache.py on lines 1000..1010

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

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

                  for m, o in modifiable.items():
                      if m in desired:
                          if not o:
                              # Always pass these through - let AWS do the math...
                              need_update[m] = desired[m]
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 2 other locations - About 6 hrs to fix
              salt/states/boto3_elasticache.py on lines 150..160
              salt/states/boto3_elasticache.py on lines 587..597

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

              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

                      for k, v in args.items():
                          if k in only_on_modify:
                              check_update = True
                          else:
                              create_args[k] = v
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 1 hr to fix
              salt/states/boto3_elasticache.py on lines 429..433

              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

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

                      for k, v in args.items():
                          if k in only_on_modify:
                              check_update = True
                          else:
                              create_args[k] = v
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 1 hr to fix
              salt/states/boto3_elasticache.py on lines 857..861

              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 current.get('SecurityGroups') is not None:
                      current['SecurityGroupIds'] = [s['SecurityGroupId'] for s in current['SecurityGroups']]
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 1 hr to fix
              salt/states/boto3_elasticache.py on lines 123..124

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 47.

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

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

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

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

              Refactorings

              Further Reading

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

                  if current.get('CacheSecurityGroups') is not None:
                      current['CacheSecurityGroupNames'] = [c['CacheSecurityGroupName'] for c in current['CacheSecurityGroups']]
              Severity: Major
              Found in salt/states/boto3_elasticache.py and 1 other location - About 1 hr to fix
              salt/states/boto3_elasticache.py on lines 121..122

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 47.

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

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

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

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

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status