Showing 64 of 69 total issues
File config.py
has 849 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
File __init__.py
has 834 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
Function read
has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring. Open
def read( # noqa
self, extension=None, quality=None
): # noqa pylint: disable=too-many-statements,too-many-branches
# returns image buffer in byte format.
- 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
File pil.py
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
BaseEngine
has 43 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseEngine:
def __init__(self, context):
self.context = context
self.image = None
self.extension = None
Function on_image_ready
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def on_image_ready( # pylint: disable=too-many-statements,too-many-branches,too-many-locals
self, buffer
):
self.watermark_engine.load(buffer, None)
self.watermark_engine.enable_alpha()
- 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
File transformer.py
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
Function __init__
has 35 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
File __init__.py
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
JSONEngine
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class JSONEngine(BaseEngine):
def __init__(self, engine, path, callback_name=None):
super().__init__(engine.context)
self.engine = engine
self.extension = engine.extension
Engine
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Engine(BaseEngine):
def __init__(self, context):
super().__init__(context)
self.subsampling = None
self.qtables = None
Function load_multiple_item
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def load_multiple_item(
self,
config_key,
conf_value,
class_name,
- 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 _calculate_target_dimensions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _calculate_target_dimensions(self):
source_width, source_height = self.engine.size
source_width = float(source_width)
source_height = float(source_height)
- 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 define_image_type
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def define_image_type(self, context, result):
if result is not None:
if isinstance(result, ResultStorageResult):
buffer = result.buffer
else:
- 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 __init__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
debug=False,
meta=False,
trim=None,
- 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 is_animated_gif
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def is_animated_gif(self, data):
if data[:6] not in [b"GIF87a", b"GIF89a"]:
return False
i = 10 # skip header
frames = 0
- 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 load
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def load(self, buffer, extension):
self.extension = extension
if extension is None:
mime = self.get_mimetype(buffer)
- 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 __init__
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function adjust_focal_points
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def adjust_focal_points(self):
source_width, source_height = self.engine.size
self.focal_points = None
- 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 reorientate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def reorientate(self, override_exif=True):
"""
Rotates the image in the buffer so that it is oriented correctly.
If override_exif is True (default) then the metadata
orientation is adjusted as well.
- 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"