saltstack/salt

View on GitHub
salt/states/boto_lambda.py

Summary

Maintainability
F
2 wks
Test Coverage

File boto_lambda.py has 802 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Manage Lambda Functions
=======================

Severity: Major
Found in salt/states/boto_lambda.py - About 1 day to fix

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

    def function_present(name, FunctionName, Runtime, Role, Handler, ZipFile=None,
                         S3Bucket=None, S3Key=None, S3ObjectVersion=None,
                         Description='', Timeout=3, MemorySize=128,
                         Permissions=None, RoleRetries=5, region=None, key=None,
                         keyid=None, profile=None, VpcConfig=None,
    Severity: Minor
    Found in salt/states/boto_lambda.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 _function_code_present has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _function_code_present(FunctionName, ZipFile, S3Bucket, S3Key,
                               S3ObjectVersion, region, key, keyid, profile):
        ret = {'result': True, 'comment': '', 'changes': {}}
        func = __salt__['boto_lambda.describe_function'](
            FunctionName, region=region,
    Severity: Minor
    Found in salt/states/boto_lambda.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 _function_permissions_present has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def _function_permissions_present(FunctionName, Permissions,
                                      region, key, keyid, profile):
        ret = {'result': True, 'comment': '', 'changes': {}}
        curr_permissions = __salt__['boto_lambda.get_permissions'](
            FunctionName, region=region,
    Severity: Minor
    Found in salt/states/boto_lambda.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 event_source_mapping_present has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def event_source_mapping_present(name, EventSourceArn, FunctionName,
                                     StartingPosition, Enabled=True, BatchSize=100,
                                     region=None, key=None, keyid=None,
                                     profile=None):
        '''
    Severity: Minor
    Found in salt/states/boto_lambda.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 alias_present has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def alias_present(name, FunctionName, Name, FunctionVersion, Description='',
                      region=None, key=None, keyid=None, profile=None):
        '''
        Ensure alias exists.
    
    
    Severity: Minor
    Found in salt/states/boto_lambda.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 _function_config_present has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _function_config_present(FunctionName, Role, Handler, Description, Timeout,
                                 MemorySize, VpcConfig, Environment, region,
                                 key, keyid, profile, RoleRetries):
        ret = {'result': True, 'comment': '', 'changes': {}}
        func = __salt__['boto_lambda.describe_function'](
    Severity: Minor
    Found in salt/states/boto_lambda.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid too many return statements within this function.
    Open

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

      Avoid too many return statements within this function.
      Open

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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

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

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

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

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

                          def function_absent(name, FunctionName, region=None, key=None, keyid=None, profile=None):
                              '''
                              Ensure function with passed properties is absent.
                          
                              name
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 3 other locations - About 3 days to fix
                          salt/states/boto_cloudtrail.py on lines 318..374
                          salt/states/boto_elasticsearch_domain.py on lines 328..385
                          salt/states/boto_iot.py on lines 749..805

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                          def _get_function_arn(name, region=None, key=None, keyid=None, profile=None):
                              if name.startswith('arn:aws:lambda:'):
                                  return name
                          
                              account_id = __salt__['boto_iam.get_account_id'](
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 6 hrs to fix
                          salt/modules/boto_cloudtrail.py on lines 393..404

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

                          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

                              for key, val in six.iteritems(options):
                                  if _describe[key] != val:
                                      need_update = True
                                      ret['changes'].setdefault('old', {})[key] = _describe[key]
                                      ret['changes'].setdefault('new', {})[key] = val
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 4 hrs to fix
                          salt/states/boto_lambda.py on lines 357..361
                          salt/states/boto_lambda.py on lines 654..658

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

                          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

                              for key, val in six.iteritems(options):
                                  if _describe[key] != val:
                                      need_update = True
                                      ret['changes'].setdefault('old', {})[key] = _describe[key]
                                      ret['changes'].setdefault('new', {})[key] = val
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 4 hrs to fix
                          salt/states/boto_lambda.py on lines 357..361
                          salt/states/boto_lambda.py on lines 862..866

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

                          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

                              for key, val in six.iteritems(options):
                                  if func[key] != val:
                                      need_update = True
                                      ret['changes'].setdefault('old', {})[key] = func[key]
                                      ret['changes'].setdefault('new', {})[key] = val
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 4 hrs to fix
                          salt/states/boto_lambda.py on lines 654..658
                          salt/states/boto_lambda.py on lines 862..866

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

                          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 '://' in ZipFile:  # Looks like a remote URL to me...
                                      dlZipFile = __salt__['cp.cache_file'](path=ZipFile)
                                      if dlZipFile is False:
                                          ret['result'] = False
                                          ret['comment'] = 'Failed to cache ZipFile `{0}`.'.format(ZipFile)
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 3 hrs to fix
                          salt/modules/boto_lambda.py on lines 254..260

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

                          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

                              if not _ret.get('result'):
                                  ret['result'] = _ret.get('result', False)
                                  ret['comment'] = _ret['comment']
                                  ret['changes'] = {}
                                  return ret
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 3 hrs to fix
                          salt/states/boto_lambda.py on lines 286..290
                          salt/states/boto_lambda.py on lines 295..299

                          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

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

                              if not _ret.get('result'):
                                  ret['result'] = _ret.get('result', False)
                                  ret['comment'] = _ret['comment']
                                  ret['changes'] = {}
                                  return ret
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 3 hrs to fix
                          salt/states/boto_lambda.py on lines 286..290
                          salt/states/boto_lambda.py on lines 304..308

                          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

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

                              if not _ret.get('result'):
                                  ret['result'] = _ret.get('result', False)
                                  ret['comment'] = _ret['comment']
                                  ret['changes'] = {}
                                  return ret
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 3 hrs to fix
                          salt/states/boto_lambda.py on lines 295..299
                          salt/states/boto_lambda.py on lines 304..308

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

                                  if not func.get('updated'):
                                      ret['result'] = False
                                      ret['comment'] = ('Failed to update function: '
                                                        '{0}.'.format(func['error']['message']))
                                      ret['changes'] = {}
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 7 other locations - About 2 hrs to fix
                          salt/states/boto_cloudtrail.py on lines 205..209
                          salt/states/boto_cloudtrail.py on lines 275..279
                          salt/states/boto_cloudtrail.py on lines 284..288
                          salt/states/boto_cloudtrail.py on lines 292..296
                          salt/states/boto_cloudwatch_event.py on lines 236..240
                          salt/states/boto_iam.py on lines 1530..1534
                          salt/states/boto_iot.py on lines 392..396

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

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

                                  if not _r.get('updated'):
                                      ret['result'] = False
                                      ret['comment'] = ('Failed to update function: '
                                                        '{0}.'.format(_r['error']['message']))
                                      ret['changes'] = {}
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 4 other locations - About 2 hrs to fix
                          salt/states/boto_iot.py on lines 742..745
                          salt/states/boto_lambda.py on lines 503..507
                          salt/states/boto_lambda.py on lines 670..674
                          salt/states/boto_lambda.py on lines 892..896

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

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

                                      if not _r.get('updated'):
                                          ret['result'] = False
                                          ret['comment'] = ('Failed to update function: '
                                                            '{0}.'.format(_r['error']['message']))
                                          ret['changes'] = {}
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 4 other locations - About 2 hrs to fix
                          salt/states/boto_iot.py on lines 742..745
                          salt/states/boto_lambda.py on lines 393..397
                          salt/states/boto_lambda.py on lines 670..674
                          salt/states/boto_lambda.py on lines 892..896

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

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

                                  if not _r.get('updated'):
                                      ret['result'] = False
                                      ret['comment'] = ('Failed to update mapping: '
                                                        '{0}.'.format(_r['error']['message']))
                                      ret['changes'] = {}
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 4 other locations - About 2 hrs to fix
                          salt/states/boto_iot.py on lines 742..745
                          salt/states/boto_lambda.py on lines 393..397
                          salt/states/boto_lambda.py on lines 503..507
                          salt/states/boto_lambda.py on lines 670..674

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

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

                                  if not _r.get('updated'):
                                      ret['result'] = False
                                      ret['comment'] = ('Failed to update alias: '
                                                        '{0}.'.format(_r['error']['message']))
                                      ret['changes'] = {}
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 4 other locations - About 2 hrs to fix
                          salt/states/boto_iot.py on lines 742..745
                          salt/states/boto_lambda.py on lines 393..397
                          salt/states/boto_lambda.py on lines 503..507
                          salt/states/boto_lambda.py on lines 892..896

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

                          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 __utils__['boto3.ordered'](oldval) != __utils__['boto3.ordered'](fixed_VpcConfig):
                                  need_update = True
                                  ret['changes'].setdefault('new', {})['VpcConfig'] = fixed_VpcConfig
                                  ret['changes'].setdefault(
                                      'old', {})['VpcConfig'] = func.get('VpcConfig')
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 2 hrs to fix
                          salt/states/boto_lambda.py on lines 374..377

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

                          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 func.get('Environment') != Environment:
                                      need_update = True
                                      ret['changes'].setdefault('new', {})['Environment'] = Environment
                                      ret['changes'].setdefault('old', {})['Environment'] = func.get(
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 2 hrs to fix
                          salt/states/boto_lambda.py on lines 367..371

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  r = __salt__['boto_lambda.create_function'](
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 3 other locations - About 2 hrs to fix
                          salt/states/azurearm_dns.py on lines 594..594
                          salt/states/boto_lc.py on lines 263..263
                          salt/states/virt.py on lines 454..454

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 58.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              sns = [__salt__['boto_vpc.get_resource_id']('subnet', s, region=region, key=key,
                                      keyid=keyid, profile=profile).get('id') for s in conf.pop('SubnetNames', [])]
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 2 hrs to fix
                          salt/modules/boto_lambda.py on lines 202..203

                          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

                                  _r = __salt__['boto_lambda.update_function_config'](
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 2 other locations - About 1 hr to fix
                          salt/states/boto_cloudtrail.py on lines 169..169
                          salt/states/boto_cloudtrail.py on lines 264..264

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

                          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

                              sgs = [__salt__['boto_secgroup.get_group_id'](s, region=region, key=key, keyid=keyid,
                                      profile=profile) for s in conf.pop('SecurityGroupNames', [])]
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 1 hr to fix
                          salt/modules/boto_lambda.py on lines 204..205

                          Duplicated Code

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

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

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

                          Tuning

                          This issue has a mass of 43.

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

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

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

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

                          Refactorings

                          Further Reading

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

                                  if __opts__['test']:
                                      ret['comment'] = (
                                          'Event source mapping {0} set to be modified.'.format(
                                              _describe['UUID']
                                          )
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 1 other location - About 1 hr to fix
                          salt/states/boto_kms.py on lines 353..356

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

                                  r = __salt__['boto_lambda.create_event_source_mapping'](
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 8 other locations - About 35 mins to fix
                          salt/states/boto_elasticache.py on lines 315..315
                          salt/states/boto_iot.py on lines 687..687
                          salt/states/boto_iot.py on lines 735..735
                          salt/states/chocolatey.py on lines 421..421
                          salt/states/csf.py on lines 93..93
                          salt/states/mount.py on lines 1117..1118
                          salt/states/mount.py on lines 1161..1171
                          salt/states/postgres_cluster.py on lines 96..96

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

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

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

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

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

                          Refactorings

                          Further Reading

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

                                          if not r.get('updated'):
                                              ret['result'] = False
                                              ret['comment'] = ('Failed to create function: '
                                                                '{0}.'.format(r['error']['message']))
                          Severity: Major
                          Found in salt/states/boto_lambda.py and 3 other locations - About 35 mins to fix
                          salt/states/boto_kms.py on lines 275..277
                          salt/states/boto_kms.py on lines 294..296
                          salt/states/smartos.py on lines 1077..1080

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

                          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