boroivanov/ecs-tools

View on GitHub

Showing 24 of 32 total issues

Either merge this branch with the identical one on line "171" or change one of the implementations.
Open

                click.echo(e, err=True)
Severity: Major
Found in ecstools/resources/service.py by sonar-python

Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

Noncompliant Code Example

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_thing()  # Noncompliant; duplicates first condition
else:
    do_the_rest()

b = 4 if a > 12 else 4

Compliant Solution

if (0 <= a < 10) or (20 <= a < 50):
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
else:
    do_the_rest()

b = 4

or

if 0 <= a < 10:
    do_the_thing()
elif 10 <= a < 20:
    do_the_other_thing()
elif 20 <= a < 50:
    do_the_third_thing()
else:
    do_the_rest()

b = 8 if a > 12 else 4

Rename function "ls" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

def ls(ctx, arn):

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

Rename function "ls" to match the regular expression ^[a-z_][a-z0-9_]{2,}$.
Open

def ls(ctx, cluster, all_stats, arn):

Shared coding conventions allow teams to collaborate efficiently. This rule checks that all function names match a provided regular expression.

Noncompliant Code Example

With the default provided regular expression: ^[a-z_][a-z0-9_]{2,30}$

def MyFunction(a,b):
    ...

Compliant Solution

def my_function(a,b):
    ...

subprocess call - check for execution of untrusted input.
Open

        subprocess.check_call(shlex.split(cmd))
Severity: Info
Found in ecstools/commands/service/exec.py by bandit
Severity
Category
Status
Source
Language