Python

Python

By DeepSource

Docstring is over-indented FLK-D208
Documentation
Minor

It is recommended to properly indent docstrings for readability.

Audit required: Use of md5 BAN-B303
Security
Minor

Use of insecure MD2, MD4, MD5, or SHA1 hash functions should be avoided. Using more secure algorithms like SHA256 or SHA512.

Audit required: Use of insecure cipher BAN-B304
Security
Major

Use of insecure cipher or cipher mode. Replace with a known secure cipher such as AES.

Audit required: Use of insecure cipher mode BAN-B305
Security
Major

Use of insecure cipher or cipher mode. Replace with a known secure cipher such as AES.

Nullable ManyToManyField found PTC-W0905
Bug risk
Major
Autofix

Having a nullable many-to-many field doesn't do anything. The declaration of a ManyToManyField causes the creation of an intermediate table to hold the relationship. Each relation between the two tables is an entry in this new table. By definition, having no relations between two tables would mean no entries in this table. There's no use of null. Consider removing null=True from this property.

Audit required: Insecure cipher BAN-W1004
Security
Major

Cipher used is not secure. It is recommended to replace with a known secure cipher such as AES.

Defining equality for a class without also defining hashability PYL-W1641
Bug risk
Major

In order to conform to the object model, classes that define their own equality method should also define their own hash method, or be unhashable. If the hash method is not defined then the hash of the super class is used. This is unlikely to result in the expected behavior. A class can be made unhashable by setting its __hash__ attribute to None.

Audit required: Insecure cipher mode BAN-W1005
Security
Major

Use of insecure cipher mode such as ECB is not recommended for use in cryptographic protocols at all. In case of ECB, it encrypts identical plaintext blocks into identical ciphertext blocks; and does not hide data patterns well. In some senses, it doesn't provide serious message confidentiality.

Audit required: Insecure hash function BAN-W1003
Security
Major

D2, MD4, MD5, SHA1 signature algorithms are known to be vulnerable to collision attacks. Attackers can exploit this to generate another certificate with the same digital signature, allowing them to masquerade as the affected service.

Tab after comma detected FLK-E242
Style
Minor

There should be only one space after the , character.

Continuation line over-indented for hanging indent FLK-E126
Style
Minor

A continuation line is indented farther than it should be for a hanging indent.

Implicit enumerate calls found PTC-W0060
Anti-pattern
Major
Autofix

Using range(len(...)) is not pythonic. Python does not have not index-based loops. Instead, it uses collection iterators. Python has a built-in method enumerate which adds a counter to an iterable.

Use of len(seq) - 1 to get last element of an iterable PTC-W0044
Performance
Major
Autofix

There’s no need to calculate length of an iterable in order to fetch the last element of the iterable. You can provide a negative index -1 to it directly in orger to get the last element. In this way, you don't have to iterate over the sequence using len to get the last index when your purpose is only to get the last element.

Pythagorean calculation detected with sub-optimal numerics PTC-W0028
Anti-pattern
Major
Autofix

Calculating the length of the hypotenuse using the standard formula c = sqrt(a**2 + b**2) may lead to overflow if the two other sides are both very large. Even though c will not be much bigger than max(a, b), either a**2 or b**2 (or both) could be. Thus, the calculation could overflow, even though the result is well within representable range. It is recommended to use the built-in function hypot(a,b) from the math library.

Type error while assignment TYP-014
Type check
Major

Encountered a TypeError while assignment. Please see the message occurrence.

Invalid type for __all__ TYP-056
Type check
Major

Type of __all__ must be sequence string. See the issue message for more details

Simplify boolean expression PYL-R1709
Anti-pattern
Major

The boolean expression with redundant pre-python 2.5 ternary syntax is used and can be simplified for better readability. Please look at the issue text for suggestion.

Invalid Literal[...] type hint TYP-041
Type check
Major

Arbitrary arguments are given to Literal[...], which makes it an invalid type. It is recommended to remove the arbitrary arguments.