saltstack/salt

View on GitHub
salt/modules/boto_cloudfront.py

Summary

Maintainability
F
1 mo
Test Coverage

File boto_cloudfront.py has 1344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

.. versionadded:: 2018.3.0
Severity: Major
Found in salt/modules/boto_cloudfront.py - About 3 days to fix

    Function _list_distributions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _list_distributions(
        conn,
        name=None,
        region=None,
        key=None,
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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_distribution has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_distribution(
        name,
        config,
        tags=None,
        region=None,
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 disable_distribution has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def disable_distribution(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Set a CloudFront distribution to be disabled.
    
        Id
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 list_distributions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_distributions(region=None, key=None, keyid=None, profile=None):
        '''
        List, with moderate information, all CloudFront distributions in the bound account.
    
        region
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 list_cloud_front_origin_access_identities has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_cloud_front_origin_access_identities(region=None, key=None, keyid=None, profile=None):
        '''
        List, with moderate information, all CloudFront origin access identities in the bound account.
    
        region
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 create_cloud_front_origin_access_identity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                  **kwargs):
        '''
        Create a CloudFront origin access identity with the provided configuration details.
    
    
    Severity: Minor
    Found in salt/modules/boto_cloudfront.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function create_distribution_v2 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Create a CloudFront distribution with the provided configuration details.  A LOT of fields are
        required in DistributionConfig to make up a valid creation request.  Details can be found at
        __: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-overview-required-fields.html
    Severity: Minor
    Found in salt/modules/boto_cloudfront.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function list_tags_for_resource has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_tags_for_resource(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        List tags attached to a CloudFront resource.
    
        Resource
    Severity: Minor
    Found in salt/modules/boto_cloudfront.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function get_distribution_v2 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Get information about a CloudFront distribution given its Resource ID.
    
        Id
    Severity: Minor
    Found in salt/modules/boto_cloudfront.py - About 55 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def get_cloud_front_origin_access_identity_config(region=None, key=None, keyid=None, profile=None,
                                                      **kwargs):
        '''
        Get config information about a CloudFront origin access identity given its Resource ID.
    
    
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 delete_cloud_front_origin_access_identity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                  **kwargs):
        '''
        Delete a CloudFront origin access identity.
    
    
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 tag_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def tag_resource(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Add tags to a CloudFront resource.
    
        Resource
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 update_cloud_front_origin_access_identity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                  **kwargs):
        '''
        Update a CloudFront origin access identity with the provided configuration details.
    
    
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 delete_distribution has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def delete_distribution(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Delete a CloudFront distribution.
    
        Id
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 untag_resource has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def untag_resource(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Remove tags from a CloudFront resource.
    
        Resource
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 update_distribution_v2 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Update a CloudFront distribution with the provided configuration details.  A LOT of fields are
        required in DistributionConfig to make up a valid update request.  Details can be found at
        __: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-overview-required-fields.html
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 get_distribution_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_distribution_config(region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Get config information about a CloudFront distribution given its Resource ID.
    
        Id
    Severity: Minor
    Found in salt/modules/boto_cloudfront.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 get_cloud_front_origin_access_identity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                               **kwargs):
        '''
        Get information about a CloudFront origin access identity given its Resource ID.
    
    
    Severity: Minor
    Found in salt/modules/boto_cloudfront.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid too many return statements within this function.
    Open

        return {'result': distribution}
    Severity: Major
    Found in salt/modules/boto_cloudfront.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

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

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

        def get_distribution(name, region=None, key=None, keyid=None, profile=None):
            '''
            Get information about a CloudFront distribution (configuration, tags) with a given name.
        
            name
        Severity: Minor
        Found in salt/modules/boto_cloudfront.py - About 25 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

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

        def list_cloud_front_origin_access_identities(region=None, key=None, keyid=None, profile=None):
            '''
            List, with moderate information, all CloudFront origin access identities in the bound account.
        
            region
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 564..609

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

        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 list_distributions(region=None, key=None, keyid=None, profile=None):
            '''
            List, with moderate information, all CloudFront distributions in the bound account.
        
            region
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 1087..1132

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

        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

        def get_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
            '''
            Get information about a CloudFront distribution given its Resource ID.
        
            Id
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 514..561
        salt/modules/boto_cloudfront.py on lines 1135..1183
        salt/modules/boto_cloudfront.py on lines 1186..1234
        salt/modules/boto_cloudfront.py on lines 1341..1402

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

        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

        def get_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                   **kwargs):
            '''
            Get information about a CloudFront origin access identity given its Resource ID.
        
        
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 464..511
        salt/modules/boto_cloudfront.py on lines 514..561
        salt/modules/boto_cloudfront.py on lines 1186..1234
        salt/modules/boto_cloudfront.py on lines 1341..1402

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

        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

        def get_cloud_front_origin_access_identity_config(region=None, key=None, keyid=None, profile=None,
                                                          **kwargs):
            '''
            Get config information about a CloudFront origin access identity given its Resource ID.
        
        
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 464..511
        salt/modules/boto_cloudfront.py on lines 514..561
        salt/modules/boto_cloudfront.py on lines 1135..1183
        salt/modules/boto_cloudfront.py on lines 1341..1402

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

        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

        def update_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                      **kwargs):
            '''
            Update a CloudFront origin access identity with the provided configuration details.
        
        
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 464..511
        salt/modules/boto_cloudfront.py on lines 514..561
        salt/modules/boto_cloudfront.py on lines 1135..1183
        salt/modules/boto_cloudfront.py on lines 1186..1234

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

        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

        def get_distribution_config(region=None, key=None, keyid=None, profile=None, **kwargs):
            '''
            Get config information about a CloudFront distribution given its Resource ID.
        
            Id
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 464..511
        salt/modules/boto_cloudfront.py on lines 1135..1183
        salt/modules/boto_cloudfront.py on lines 1186..1234
        salt/modules/boto_cloudfront.py on lines 1341..1402

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

        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 create_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
            '''
            Create a CloudFront distribution with the provided configuration details.  A LOT of fields are
            required in DistributionConfig to make up a valid creation request.  Details can be found at
            __: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-overview-required-fields.html
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 830..975

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

        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 update_distribution_v2(region=None, key=None, keyid=None, profile=None, **kwargs):
            '''
            Update a CloudFront distribution with the provided configuration details.  A LOT of fields are
            required in DistributionConfig to make up a valid update request.  Details can be found at
            __: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-overview-required-fields.html
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 2 days to fix
        salt/modules/boto_cloudfront.py on lines 691..827

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

        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 delete_distribution(region=None, key=None, keyid=None, profile=None, **kwargs):
            '''
            Delete a CloudFront distribution.
        
            Id
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 1 day to fix
        salt/modules/boto_cloudfront.py on lines 1405..1452

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

        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 delete_cloud_front_origin_access_identity(region=None, key=None, keyid=None, profile=None,
                                                      **kwargs):
            '''
            Delete a CloudFront origin access identity.
        
        
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 1 day to fix
        salt/modules/boto_cloudfront.py on lines 1039..1084

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

        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

                try:
                    log.debug('Removing tags (%s) from CloudFront resource `%s`.', kwargs['TagKeys'],
                            kwargs.get('Resource'))
                    ret = conn.untag_resource(**kwargs)
                    return True
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 2 other locations - About 6 hrs to fix
        salt/modules/boto_cloudfront.py on lines 1519..1534
        salt/modules/boto_cloudfront.py on lines 1573..1588

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

        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

                try:
                    log.debug('Listing tags for CloudFront resource `%s`.', kwargs.get('Resource'))
                    ret = conn.list_tags_for_resource(**kwargs)
                    tags = {t['Key']: t['Value'] for t in ret.get('Tags', {}).get('Items', [])}
                    return tags
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 2 other locations - About 6 hrs to fix
        salt/modules/boto_cloudfront.py on lines 1573..1588
        salt/modules/boto_cloudfront.py on lines 1626..1641

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

        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

                try:
                    log.debug('Adding tags (%s) to CloudFront resource `%s`.', kwargs['Tags'],
                            kwargs.get('Resource'))
                    conn.tag_resource(**kwargs)
                    return True
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 2 other locations - About 6 hrs to fix
        salt/modules/boto_cloudfront.py on lines 1519..1534
        salt/modules/boto_cloudfront.py on lines 1626..1641

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

        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 cloud_front_origin_access_identity_exists(Id, region=None, key=None, keyid=None, profile=None):
            '''
            Return True if a CloudFront origin access identity exists with the given Resource ID or False
            otherwise.
        
        
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 4 hrs to fix
        salt/modules/boto_cloudfront.py on lines 612..640

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

        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 distribution_exists(Id, region=None, key=None, keyid=None, profile=None):
            '''
            Return True if a CloudFront distribution exists with the given Resource ID or False otherwise.
        
            Id
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 1 other location - About 4 hrs to fix
        salt/modules/boto_cloudfront.py on lines 1455..1484

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

        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

        def __virtual__():
            '''
            Only load if boto3 libraries exist.
            '''
            has_boto_reqs = salt.utils.versions.check_boto_reqs()
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 4 other locations - About 1 hr to fix
        salt/modules/boto3_sns.py on lines 68..75
        salt/modules/boto_elbv2.py on lines 69..76
        salt/modules/boto_sqs.py on lines 78..85
        salt/modules/boto_ssm.py on lines 27..34

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

        try:
            # pylint: disable=unused-import
            import boto3
            import botocore
            # pylint: enable=unused-import
        Severity: Major
        Found in salt/modules/boto_cloudfront.py and 7 other locations - About 30 mins to fix
        salt/modules/boto3_elasticache.py on lines 65..73
        salt/modules/boto_kinesis.py on lines 61..67
        salt/modules/boto_s3.py on lines 63..71
        salt/modules/boto_secgroup.py on lines 61..69
        salt/modules/boto_sns.py on lines 55..63
        salt/modules/boto_sqs.py on lines 67..75
        salt/utils/botomod.py on lines 52..60

        Duplicated Code

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

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

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

        Tuning

        This issue has a mass of 40.

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

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

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

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

        Refactorings

        Further Reading

        There are no issues that match your filters.

        Category
        Status