saltstack/salt

View on GitHub
salt/modules/boto_s3_bucket.py

Summary

Maintainability
F
1 wk
Test Coverage

File boto_s3_bucket.py has 729 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

    Function describe has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def describe(Bucket,
                 region=None, key=None, keyid=None, profile=None):
        '''
        Given a bucket name describe its properties.
    
    
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 delete_objects has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_objects(Bucket, Delete, MFA=None, RequestPayer=None,
                       region=None, key=None, keyid=None, profile=None):
        '''
        Delete objects in a given S3 bucket.
    
    
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 put_website has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def put_website(Bucket, ErrorDocument=None, IndexDocument=None,
               RedirectAllRequestsTo=None, RoutingRules=None,
               region=None, key=None, keyid=None, profile=None):
        '''
        Given a valid config, update the website configuration for a bucket.
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def list_objects(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
                     FetchOwner=False, StartAfter=None, region=None, key=None,
                     keyid=None, profile=None):
        '''
        List objects in a given S3 bucket.
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def list_object_versions(Bucket, Delimiter=None, EncodingType=None, Prefix=None,
                     region=None, key=None, keyid=None, profile=None):
        '''
        List objects in a given S3 bucket.
    
    
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 put_notification_configuration has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def put_notification_configuration(Bucket,
               TopicConfigurations=None, QueueConfigurations=None,
               LambdaFunctionConfigurations=None,
               region=None, key=None, keyid=None, profile=None):
        '''
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 put_logging has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def put_logging(Bucket,
               TargetBucket=None, TargetPrefix=None, TargetGrants=None,
               region=None, key=None, keyid=None, profile=None):
        '''
        Given a valid config, update the logging parameters for a bucket.
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(Bucket,
               ACL=None, LocationConstraint=None,
               GrantFullControl=None,
               GrantRead=None,
               GrantReadACP=None,
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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 put_acl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def put_acl(Bucket,
               ACL=None,
               AccessControlPolicy=None,
               GrantFullControl=None,
               GrantRead=None,
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.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

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

    def put_cors(Bucket,
               CORSRules,
               region=None, key=None, keyid=None, profile=None):
        '''
        Given a valid config, update the CORS rules for a bucket.
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 1 day to fix
    salt/modules/boto_s3_bucket.py on lines 527..559

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

    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 put_lifecycle_configuration(Bucket,
               Rules,
               region=None, key=None, keyid=None, profile=None):
        '''
        Given a valid config, update the Lifecycle rules for a bucket.
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 1 day to fix
    salt/modules/boto_s3_bucket.py on lines 494..524

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

    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

    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_s3_bucket.py and 2 other locations - About 6 hrs to fix
    salt/modules/boto_lambda.py on lines 176..187
    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 6 locations. Consider refactoring.
    Open

    def delete_lifecycle_configuration(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Delete the lifecycle configuration for the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 845..866
    salt/modules/boto_s3_bucket.py on lines 893..914
    salt/modules/boto_s3_bucket.py on lines 917..938
    salt/modules/boto_s3_bucket.py on lines 941..962
    salt/modules/boto_s3_bucket.py on lines 965..986

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete_website(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Remove the website configuration from the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 845..866
    salt/modules/boto_s3_bucket.py on lines 869..890
    salt/modules/boto_s3_bucket.py on lines 893..914
    salt/modules/boto_s3_bucket.py on lines 917..938
    salt/modules/boto_s3_bucket.py on lines 941..962

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete_tagging(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Delete the tags from the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 845..866
    salt/modules/boto_s3_bucket.py on lines 869..890
    salt/modules/boto_s3_bucket.py on lines 893..914
    salt/modules/boto_s3_bucket.py on lines 917..938
    salt/modules/boto_s3_bucket.py on lines 965..986

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete_replication(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Delete the replication config from the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 845..866
    salt/modules/boto_s3_bucket.py on lines 869..890
    salt/modules/boto_s3_bucket.py on lines 893..914
    salt/modules/boto_s3_bucket.py on lines 941..962
    salt/modules/boto_s3_bucket.py on lines 965..986

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete_cors(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Delete the CORS configuration for the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 869..890
    salt/modules/boto_s3_bucket.py on lines 893..914
    salt/modules/boto_s3_bucket.py on lines 917..938
    salt/modules/boto_s3_bucket.py on lines 941..962
    salt/modules/boto_s3_bucket.py on lines 965..986

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete_policy(Bucket,
               region=None, key=None, keyid=None, profile=None):
        '''
        Delete the policy from the given bucket
    
    
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 5 other locations - About 4 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 845..866
    salt/modules/boto_s3_bucket.py on lines 869..890
    salt/modules/boto_s3_bucket.py on lines 917..938
    salt/modules/boto_s3_bucket.py on lines 941..962
    salt/modules/boto_s3_bucket.py on lines 965..986

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

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

        try:
            conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
            result = {}
            conn_dict = {'ACL': conn.get_bucket_acl,
                         'CORS': conn.get_bucket_cors,
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 6 other locations - About 3 hrs to fix
    salt/modules/boto_cloudtrail.py on lines 211..229
    salt/modules/boto_cloudtrail.py on lines 247..270
    salt/modules/boto_iot.py on lines 375..388
    salt/modules/boto_iot.py on lines 407..416
    salt/modules/boto_iot.py on lines 494..508
    salt/modules/boto_iot.py on lines 710..723

    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

            for arg in ('ACL', 'GrantFullControl',
                        'GrantRead', 'GrantReadACP',
                        'GrantWrite', 'GrantWriteACP'):
                if locals()[arg] is not None:
                    kwargs[arg] = str(locals()[arg])  # future lint: disable=blacklisted-function
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 2 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 482..487

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

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

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

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

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

    Refactorings

    Further Reading

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

            for arg in ('ACL',
                        'GrantFullControl',
                        'GrantRead', 'GrantReadACP',
                        'GrantWrite', 'GrantWriteACP'):
                if locals()[arg] is not None:
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 2 hrs to fix
    salt/modules/boto_s3_bucket.py on lines 159..163

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

    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

            conn_dict = {'ACL': conn.get_bucket_acl,
                         'CORS': conn.get_bucket_cors,
                         'LifecycleConfiguration': conn.get_bucket_lifecycle_configuration,
                         'Location': conn.get_bucket_location,
                         'Logging': conn.get_bucket_logging,
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 1 hr to fix
    salt/cloud/clouds/msazure.py on lines 338..349

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

    try:
        # pylint: disable=unused-import
        import boto
        import boto3
        # pylint: enable=unused-import
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 3 other locations - About 45 mins to fix
    salt/modules/boto_cfn.py on lines 47..56
    salt/modules/boto_cloudtrail.py on lines 66..75
    salt/modules/boto_elbv2.py on lines 55..66

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

            if TopicConfigurations is None:
                TopicConfigurations = []
            elif isinstance(TopicConfigurations, six.string_types):
                TopicConfigurations = salt.utils.json.loads(TopicConfigurations)
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 3 other locations - About 40 mins to fix
    salt/modules/boto_s3_bucket.py on lines 627..630
    salt/modules/boto_s3_bucket.py on lines 631..634
    salt/modules/boto_s3_bucket.py on lines 708..711

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

    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 LambdaFunctionConfigurations is None:
                LambdaFunctionConfigurations = []
            elif isinstance(LambdaFunctionConfigurations, six.string_types):
                LambdaFunctionConfigurations = salt.utils.json.loads(LambdaFunctionConfigurations)
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 3 other locations - About 40 mins to fix
    salt/modules/boto_s3_bucket.py on lines 623..626
    salt/modules/boto_s3_bucket.py on lines 627..630
    salt/modules/boto_s3_bucket.py on lines 708..711

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

    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 QueueConfigurations is None:
                QueueConfigurations = []
            elif isinstance(QueueConfigurations, six.string_types):
                QueueConfigurations = salt.utils.json.loads(QueueConfigurations)
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 3 other locations - About 40 mins to fix
    salt/modules/boto_s3_bucket.py on lines 623..626
    salt/modules/boto_s3_bucket.py on lines 631..634
    salt/modules/boto_s3_bucket.py on lines 708..711

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

    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 Rules is None:
                Rules = []
            elif isinstance(Rules, six.string_types):
                Rules = salt.utils.json.loads(Rules)
    Severity: Major
    Found in salt/modules/boto_s3_bucket.py and 3 other locations - About 40 mins to fix
    salt/modules/boto_s3_bucket.py on lines 623..626
    salt/modules/boto_s3_bucket.py on lines 627..630
    salt/modules/boto_s3_bucket.py on lines 631..634

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

    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)
            buckets = conn.head_bucket(Bucket=Bucket)
            return {'exists': True}
    Severity: Minor
    Found in salt/modules/boto_s3_bucket.py and 1 other location - About 35 mins to fix
    salt/modules/boto_iot.py on lines 710..713

    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