It is recommended to properly indent docstrings for readability.
md5
BAN-B303Use of insecure MD2, MD4, MD5, or SHA1 hash functions should be avoided. Using more secure algorithms like SHA256 or SHA512.
Use of insecure cipher or cipher mode. Replace with a known secure cipher such as AES.
Use of insecure cipher or cipher mode. Replace with a known secure cipher such as AES.
ManyToManyField
found PTC-W0905Having 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.
Cipher used is not secure. It is recommended to replace with a known secure cipher such as AES.
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.
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.
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.
There should be only one space after the ,
character.
A continuation line is indented farther than it should be for a hanging indent.
NotImplemented
is not allowed FLK-F901While returning NotImplemented
would be fine, raising it doesn't work and will cause a TypeError
because NotImplemented
is not an exception type.
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.
Too many decision blocks were found, which is why the code has been tagged as complex. You should consider refactoring the code for simplicity. Read more about cyclomatic complexity here.
len(seq) - 1
to get last element of an iterable PTC-W0044There’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.
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.
@staticmethod
PYL-R0201The method doesn't use its bound instance. Decorate this method with @staticmethod
decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about staticmethods here.
Encountered a TypeError
while assignment. Please see the message occurrence.
__all__
TYP-056Type of __all__
must be sequence string. See the issue message for more details
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.