Code Quality detectors

Inefficient string concatenation inside loop

Inefficient string concatenation inside loops results in new object creation which adds quadratic runtime cost.

Set SNS Return Subscription ARN

To always return the subscription ARN, set the ReturnSubscriptionArn argument to True.

Unnecessary iteration

Iteration when only one item is needed from a list is inefficient.

Outdated subprocess module API

Using outdated multiprocessing API calls and parameters is not recommended.

Catch and rethrow exception

Catching and re-throwing an exception without further actions is redundant and wasteful.

Catch and swallow exception

Swallowing exceptions, without re-throwing or logging them, is a bad practice.

Use of a deprecated method

This code uses deprecated methods, which suggests that it has not been recently reviewed or maintained.

Mutable objects as default arguments of functions

Default values in Python are created exactly once, when the function is defined. If that object is changed, subsequent calls to the function will refer to the changed object, leading to confusion.

Violation of PEP8 programming recommendations

Violating PEP8 programming recommendations might make code difficult to read and can introduce ambiguity.

Complex code hard to maintain

Complex code can be difficult to read and hard to maintain.

Confusion between equality and identity in conditional expression

Confusion between equality ==, != and identity is in conditional expressions can lead to unintended behavior.

Inefficient new method from hashlib

The constructors for the hashlib module are faster than new()

Dangerous global variables

Global variables can be dangerous and cause bugs because they can be simultaneously accessed from multiple sections of a program.

Enabling and overriding debug feature

The Debug feature should not be enabled or overridden.

Risky use of dict get method

Using the get method from the dict class without default values can cause runtime exceptions.

Socket close platform compatibility

The os.close() does not work on some platforms.

Multiple values in return statement is prone to error

Methods that return multiple values can be difficult to read and prone to error.

Bad exception handling

Throwing a base or generic exception might cause important error information to be lost. This can make your code difficult to maintain.

Use of an inefficient or incorrect API

Incorrect use of API leads to ambiguity and inconsistency

Multidimensional list initialization using replication is error prone

list replication using replication operator creates references to the existing objects, not copies, which could introduce bugs.

Inefficient polling of AWS resource

Custom polling can be inefficient and prone to error. Consider using AWS waiters instead.

Direct dict object modification

Directly modifying the dict object might cause undesirable behavior due to symbol table modification.

Incorrect use of Process.terminate API

The Process.terminate API might cause data corruption of shared resources.