boroivanov/ecs-tools

View on GitHub

Showing 6 of 32 total issues

Service has 24 functions (exceeds 20 allowed). Consider refactoring.
Open

class Service(object):
    def __init__(self, ecs, ecr, cluster, service):
        self.ecs = ecs
        self.ecr = ecr
        self._cluster = cluster
Severity: Minor
Found in ecstools/resources/service.py - About 2 hrs to fix

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

    def exec(ctx, cluster, service, command, container, task):
        """Run ECS Exec"""
        ecs = ctx.obj['ecs']
        ecr = ctx.obj['ecr']
        region = ctx.obj['region']
    Severity: Minor
    Found in ecstools/commands/service/exec.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_services has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_services(ecs, cluster):
        try:
            response = ecs.list_services(cluster=cluster, maxResults=100)
        except ClientError as e:
            if e.response['Error']['Code'] == 'ClusterNotFoundException':
    Severity: Minor
    Found in ecstools/commands/service/ls.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 _remove_options_parameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _remove_options_parameters(args):
            """
            Removes options parameters.
            Returns a list of argument parameters only.
            """
    Severity: Minor
    Found in ecstools/lib/cli.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def ls(ctx, cluster, all_stats, arn):
        """List services"""
        ecs = ctx.obj['ecs']
        ecr = ctx.obj['ecr']
    
    
    Severity: Minor
    Found in ecstools/commands/service/ls.py - About 25 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def delete_environment_variables(pairs, envs):
        for pair in pairs:
            key = pair.split('=', 1)[0]
            for e in envs:
                if key == e['name']:
    Severity: Minor
    Found in ecstools/commands/service/env.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

    Severity
    Category
    Status
    Source
    Language