saltstack/salt

View on GitHub
salt/modules/boto_lambda.py

Summary

Maintainability
F
1 wk
Test Coverage

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

# -*- coding: utf-8 -*-
'''
Connection module for Amazon Lambda

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

    Function create_function has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_function(FunctionName, Runtime, Role, Handler, ZipFile=None,
                        S3Bucket=None, S3Key=None, S3ObjectVersion=None,
                        Description="", Timeout=3, MemorySize=128, Publish=False,
                        WaitForRole=False, RoleRetries=5,
                        region=None, key=None, keyid=None, profile=None,
    Severity: Minor
    Found in salt/modules/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 update_function_config has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_function_config(FunctionName, Role=None, Handler=None,
                               Description=None, Timeout=None, MemorySize=None,
                               region=None, key=None, keyid=None, profile=None,
                               VpcConfig=None, WaitForRole=False, RoleRetries=5,
                               Environment=None):
    Severity: Minor
    Found in salt/modules/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 get_permissions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_permissions(FunctionName, Qualifier=None,
                        region=None, key=None, keyid=None, profile=None):
        '''
        Get resource permissions for the given lambda function
    
    
    Severity: Minor
    Found in salt/modules/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 update_function_code has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_function_code(FunctionName, ZipFile=None, S3Bucket=None, S3Key=None,
                             S3ObjectVersion=None, Publish=False,
                             region=None, key=None, keyid=None, profile=None):
        '''
        Upload the given code to the named lambda function.
    Severity: Minor
    Found in salt/modules/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 _find_alias has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def _find_alias(FunctionName, Name, FunctionVersion=None,
                    region=None, key=None, keyid=None, profile=None):
        '''
        Given function name and alias name, find and return matching alias information.
        '''
    Severity: Minor
    Found in salt/modules/boto_lambda.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 _get_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_ids(UUID=None, EventSourceArn=None, FunctionName=None,
                 region=None, key=None, keyid=None, profile=None):
        if UUID:
            if EventSourceArn or FunctionName:
                raise SaltInvocationError('Either UUID must be specified, or '
    Severity: Minor
    Found in salt/modules/boto_lambda.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def update_event_source_mapping(UUID,
                                    FunctionName=None, Enabled=None, BatchSize=None,
                                    region=None, key=None, keyid=None, profile=None):
        '''
        Update the event source mapping identified by the UUID.
    Severity: Minor
    Found in salt/modules/boto_lambda.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _find_function(name,
                       region=None, key=None, keyid=None, profile=None):
        '''
        Given function name, find and return matching Lambda information.
        '''
    Severity: Minor
    Found in salt/modules/boto_lambda.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _get_role_arn(name, region=None, key=None, keyid=None, profile=None):
        if name.startswith('arn:aws:iam:'):
            return name
    
        account_id = __salt__['boto_iam.get_account_id'](
    Severity: Major
    Found in salt/modules/boto_lambda.py and 2 other locations - About 6 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 674..685
    salt/states/boto_s3_bucket.py on lines 293..304

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

    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

                try:
                    r = conn.update_function_configuration(**args)
                except ClientError as e:
                    if retry > 1 and e.response.get('Error', {}).get('Code') == 'InvalidParameterValueException':
                        log.info(
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 5 hrs to fix
    salt/modules/boto_lambda.py on lines 284..295

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

    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

                try:
                    func = conn.create_function(FunctionName=FunctionName, Runtime=Runtime, Role=role_arn, Handler=Handler,
                                                Code=code, Description=Description, Timeout=Timeout, MemorySize=MemorySize,
                                                Publish=Publish, **kwargs)
                except ClientError as e:
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 5 hrs to fix
    salt/modules/boto_lambda.py on lines 422..431

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

    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

    def delete_alias(FunctionName, Name, region=None, key=None, keyid=None, profile=None):
        '''
        Given a function name and alias name, delete the alias.
    
        Returns {deleted: true} if the alias was deleted and returns
    Severity: Major
    Found in salt/modules/boto_lambda.py and 7 other locations - About 4 hrs to fix
    salt/modules/boto_apigateway.py on lines 753..769
    salt/modules/boto_apigateway.py on lines 882..898
    salt/modules/boto_apigateway.py on lines 901..917
    salt/modules/boto_apigateway.py on lines 1160..1176
    salt/modules/boto_iot.py on lines 454..476
    salt/modules/boto_iot.py on lines 643..666
    salt/modules/boto_iot.py on lines 669..691

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

    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/modules/boto_lambda.py and 1 other location - About 3 hrs to fix
    salt/states/boto_lambda.py on lines 409..415

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

            if r:
                keys = ('FunctionName', 'Runtime', 'Role', 'Handler', 'CodeSha256',
                        'CodeSize', 'Description', 'Timeout', 'MemorySize',
                        'FunctionArn', 'LastModified', 'VpcConfig', 'Environment')
                return {'updated': True, 'function': dict([(k, r.get(k)) for k in keys])}
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 3 hrs to fix
    salt/modules/boto_lambda.py on lines 436..443

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

    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 r:
                keys = ('FunctionName', 'Runtime', 'Role', 'Handler', 'CodeSha256',
                        'CodeSize', 'Description', 'Timeout', 'MemorySize',
                        'FunctionArn', 'LastModified', 'VpcConfig', 'Environment')
                return {'updated': True, 'function': dict([(k, r.get(k)) for k in keys])}
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 3 hrs to fix
    salt/modules/boto_lambda.py on lines 486..493

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

    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

    try:
        # pylint: disable=unused-import
        import boto
        import boto3
        # pylint: enable=unused-import
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 3 hrs to fix
    salt/modules/boto_apigateway.py on lines 97..108

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 63.

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

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

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

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

    Refactorings

    Further Reading

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

        try:
            conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
            kwargs = {}
            if Qualifier is not None:
                kwargs['Qualifier'] = Qualifier
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 2 hrs to fix
    salt/modules/boto_iot.py on lines 261..269

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

    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/modules/boto_lambda.py and 1 other location - About 2 hrs to fix
    salt/states/boto_lambda.py on lines 334..335

    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

    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/modules/boto_lambda.py and 1 other location - About 1 hr to fix
    salt/states/boto_lambda.py on lines 336..337

    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

            for key in ('SourceArn', 'SourceAccount', 'Qualifier'):
                if locals()[key] is not None:
                    kwargs[key] = str(locals()[key])  # future lint: disable=blacklisted-function
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 1 hr to fix
    salt/modules/boto_rds.py on lines 356..358

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 51.

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

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

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

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

    Refactorings

    Further Reading

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

            if alias:
                keys = ('AliasArn', 'Name', 'FunctionVersion', 'Description')
                return {'alias': dict([(k, alias.get(k)) for k in keys])}
            else:
                return {'alias': None}
    Severity: Major
    Found in salt/modules/boto_lambda.py and 1 other location - About 1 hr to fix
    salt/modules/boto_iot.py on lines 378..383

    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

    There are no issues that match your filters.

    Category
    Status