Showing 4 of 15 total issues
Function open
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def open(self, mode):
"""Opens a file to read or write operations."""
self._bucket_exists_()
s3cache.utils.makedirs(self.tmppath)
self.mode = mode
- Read upRead up
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 testLocallyCached
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def testLocallyCached(self):
s3 = self.bucketFactory()
# Turn on caching
s3.set_caching(True)
object_name = "/foo/cached.txt"
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, tmpdir, bucket_name,
Function connect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def connect(self):
"""Connect to AWS S3. """
if self.conn is None:
try:
self.conn = boto.connect_s3(
- Read upRead up
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"