saltstack/salt

View on GitHub
salt/modules/boto_elasticsearch_domain.py

Summary

Maintainability
F
6 days
Test Coverage

File boto_elasticsearch_domain.py has 343 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

.. versionadded:: 2016.11.0
Severity: Minor
Found in salt/modules/boto_elasticsearch_domain.py - About 4 hrs to fix

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

    def create(DomainName, ElasticsearchClusterConfig=None, EBSOptions=None,
               AccessPolicies=None, SnapshotOptions=None, AdvancedOptions=None,
               region=None, key=None, keyid=None, profile=None,
               ElasticsearchVersion=None):
        '''
    Severity: Minor
    Found in salt/modules/boto_elasticsearch_domain.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 has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def update(DomainName, ElasticsearchClusterConfig=None, EBSOptions=None,
               AccessPolicies=None, SnapshotOptions=None, AdvancedOptions=None,
               region=None, key=None, keyid=None, profile=None):
        '''
        Update the named domain to the configuration.
    Severity: Minor
    Found in salt/modules/boto_elasticsearch_domain.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 add_tags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def add_tags(DomainName=None, ARN=None,
               region=None, key=None, keyid=None, profile=None, **kwargs):
        '''
        Add tags to a domain
    
    
    Severity: Minor
    Found in salt/modules/boto_elasticsearch_domain.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_tags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_tags(DomainName=None, ARN=None,
               region=None, key=None, keyid=None, profile=None):
        '''
        List tags of a trail
    
    
    Severity: Minor
    Found in salt/modules/boto_elasticsearch_domain.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 remove_tags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def remove_tags(TagKeys, DomainName=None, ARN=None,
               region=None, key=None, keyid=None, profile=None):
        '''
        Remove tags from a trail
    
    
    Severity: Minor
    Found in salt/modules/boto_elasticsearch_domain.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

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

            if ARN is None:
                if DomainName is None:
                    raise SaltInvocationError('One (but not both) of ARN or '
                             'domain must be specified.')
                domaindata = status(DomainName=DomainName,
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 2 other locations - About 7 hrs to fix
    salt/modules/boto_elasticsearch_domain.py on lines 363..375
    salt/modules/boto_elasticsearch_domain.py on lines 442..454

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 121.

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

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

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

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

    Refactorings

    Further Reading

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

            if ARN is None:
                if DomainName is None:
                    raise SaltInvocationError('One (but not both) of ARN or '
                             'domain must be specified.')
                domaindata = status(DomainName=DomainName,
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 2 other locations - About 7 hrs to fix
    salt/modules/boto_elasticsearch_domain.py on lines 363..375
    salt/modules/boto_elasticsearch_domain.py on lines 401..413

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

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

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

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

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

    Refactorings

    Further Reading

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

            if ARN is None:
                if DomainName is None:
                    raise SaltInvocationError('One (but not both) of ARN or '
                             'domain must be specified.')
                domaindata = status(DomainName=DomainName,
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 2 other locations - About 7 hrs to fix
    salt/modules/boto_elasticsearch_domain.py on lines 401..413
    salt/modules/boto_elasticsearch_domain.py on lines 442..454

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 121.

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

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

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

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

    Refactorings

    Further Reading

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

            for k in ('ElasticsearchClusterConfig', 'EBSOptions',
                        'AccessPolicies', 'SnapshotOptions', 'AdvancedOptions',
                        'ElasticsearchVersion'):
                if locals()[k] is not None:
                    val = locals()[k]
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 1 other location - About 5 hrs to fix
    salt/modules/boto_elasticsearch_domain.py on lines 317..326

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

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

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

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

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

    Refactorings

    Further Reading

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

        for k in ('ElasticsearchClusterConfig', 'EBSOptions',
                    'AccessPolicies', 'SnapshotOptions', 'AdvancedOptions'):
            if locals()[k] is not None:
                val = locals()[k]
                if isinstance(val, six.string_types):
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 1 other location - About 5 hrs to fix
    salt/modules/boto_elasticsearch_domain.py on lines 242..252

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

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

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

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

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

    Refactorings

    Further Reading

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

    def delete(DomainName, region=None, key=None, keyid=None, profile=None):
        '''
        Given a domain name, delete it.
    
        Returns {deleted: true} if the domain was deleted and returns
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 7 other locations - About 4 hrs to fix
    salt/modules/boto_apigateway.py on lines 504..520
    salt/modules/boto_cloudtrail.py on lines 172..193
    salt/modules/boto_cloudtrail.py on lines 345..366
    salt/modules/boto_cloudtrail.py on lines 369..390
    salt/modules/boto_cloudwatch_event.py on lines 156..177
    salt/modules/boto_iot.py on lines 336..357
    salt/modules/boto_iot.py on lines 792..813

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

    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

    try:
        #pylint: disable=unused-import
        import boto
        import boto3
        #pylint: enable=unused-import
    Severity: Major
    Found in salt/modules/boto_elasticsearch_domain.py and 2 other locations - About 2 hrs to fix
    salt/modules/boto_cognitoidentity.py on lines 92..102
    salt/modules/boto_rds.py on lines 66..76

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 60.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status