Showing 42 of 60 total issues
File queue_listener.py
has 407 lines of code (exceeds 250 allowed). Consider refactoring. Open
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
Function patterns_from_tree
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def patterns_from_tree(self, start_dir: Path) -> List:
"""
Create urlpatterns from a directory structure.
By default, a package is considered a namespace, and a module with one view a pattern,
if a module has multiple views, it will also be considered a namespace.
- 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 serialize
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def serialize(obj, to_delete, last_syncs=None):
if obj:
fields = {}
for f in obj.__class__._meta.fields:
if f.is_relation and to_delete:
- 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 xls_build.py
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
ExampleConsumer
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class ExampleConsumer:
"""
This is an example consumer that will handle unexpected interactions
with RabbitMQ such as channel and connection closures.
Function persist
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def persist(structure):
try:
model_class = apps.get_model(structure.get('model'))
except LookupError:
return
- 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 execute
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def execute(sql_command):
results = []
if sql_command:
if sql_command_contains_forbidden_keyword(sql_command):
raise PermissionDenied("SQL command contains forbidden SQL keyword")
- 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 _adjust_column_width
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _adjust_column_width(worksheet):
for col in worksheet.columns:
max_length = 0
column = col[0].column_letter # Get the column name
for cell in col:
- 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 _patterns_from_views
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _patterns_from_views(module, stem) -> List:
"""
Gather patterns from a module's views.
Views must implement `django.views.generic.View` (your mixins must not!) and
be referenced in the `__all__` variable of a module to be picked.
- 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 listen_queue_synchronously
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def listen_queue_synchronously(queue_name, callback, counter=3):
def on_message(channel, method_frame, header_frame, body):
try:
callback(body)
- 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 _align_cells
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _align_cells(ws, data):
if data:
for an_align in data.keys():
cell_reference = data.get(an_align)
if cell_reference:
- 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 _set_row_font
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _set_row_font(key, row_numbers, ws):
for index, row in enumerate(ws.iter_rows()):
for r in row_numbers:
if index == r:
for cell in row:
- 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 _add_font_to_cells
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _add_font_to_cells(ws, data):
if data:
for a_font, row_number in data.items():
if row_number:
for cell in row_number:
- 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 handle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
apps.clear_cache()
workbook = load_workbook("fixtures_to_load.xlsx", read_only=True, data_only=True)
for ws in workbook.worksheets:
model_class = self._get_model_class_from_worksheet_title(ws)
- 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 debug
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def debug(self, patterns, depth=0): # pragma: no cover
"""Output a debug message from the provided patterns"""
msg: str = ''
line_prefix = ' '
for p in patterns:
- 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 _fillings_cells
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _fillings_cells(ws, data):
if data:
for a_fill in data.keys():
cell_reference = data.get(a_fill)
if cell_reference:
- 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 populate_message_history_receiver_email
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def populate_message_history_receiver_email(apps, schema_editor):
Person = apps.get_model("base", "Person")
MessageHistory = apps.get_model("osis_common", "MessageHistory")
User = apps.get_model('auth', 'User')
message_history_items = MessageHistory.objects.all()
- 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 _border_cells
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _border_cells(ws, data):
if data:
for a_border in data.keys():
cell_reference = data.get(a_border)
if cell_reference:
- 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 _set_row_fill
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _set_row_fill(key, row_numbers, ws):
for index, row in enumerate(ws.iter_rows()):
for r in row_numbers:
if index == r:
for cell in row:
- 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 create_message_content
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_message_content(