Showing 227 of 702 total issues
Function post
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request, *args, app_label, model_name, payable, **kwargs):
if "type" not in request.POST:
raise SuspiciousOperation("Missing POST parameters")
if "next" in request.POST and not url_has_allowed_host_and_scheme(
- Read upRead up
- Create a ticketCreate a ticket
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 post
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def post(self, request, *args, app_label, model_name, payable, **kwargs):
- Create a ticketCreate a ticket
Function registration_fields
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def registration_fields(request, member=None, event=None, registration=None, name=None):
- Create a ticketCreate a ticket
Function request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function request(method, url, data, success, error) {
- Create a ticketCreate a ticket
Function request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function request(method, url, data, success, error) {
- Create a ticketCreate a ticket
Function formfield_for_dbfield
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def formfield_for_dbfield(self, db_field, request, obj=None, **kwargs):
- Create a ticketCreate a ticket
Function setting
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def setting(*, development, production, staging=_NOT_SET, testing=_NOT_SET):
- Create a ticketCreate a ticket
Function test_post
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_post(
- Create a ticketCreate a ticket
Function save
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save(
- Create a ticketCreate a ticket
Function save
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save(
- Create a ticketCreate a ticket
Function save_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_model(self, request, obj, form, change):
- Create a ticketCreate a ticket
Function change_view
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_view(self, request, object_id, form_url="", extra_context=None):
- Create a ticketCreate a ticket
Function changeform_view
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def changeform_view(self, request, object_id=None, form_url="", extra_context=None):
- Create a ticketCreate a ticket
Function _show_message
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _show_message(
- Create a ticketCreate a ticket
Function update_thabloid_blacklist_for_user
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_thabloid_blacklist_for_user(form, instance, commit, *args, **kwargs):
- Create a ticketCreate a ticket
Function save
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save(
- Create a ticketCreate a ticket
Function create_image_thumbnail_dict
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_image_thumbnail_dict(
- Create a ticketCreate a ticket
Function get_event_to_register_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_event_to_register_for(member):
for event in Event.objects.filter(published=True).order_by("?"):
if event.registration_required and not event.reached_participants_limit():
if member.id not in event.registrations.values_list("member", flat=True):
return event
- Read upRead up
- Create a ticketCreate a ticket
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 rows_distributed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rows_distributed(thelist, n):
"""Break a list into ``n`` rows, distributing columns as evenly as possible across the rows.
For example::
- Read upRead up
- Create a ticketCreate a ticket
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 perform_create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def perform_create(self, serializer):
try:
if serializer.validated_data.get("name"):
serializer.save(food_event=FoodEvent.current())
elif can_change_order(self.request.member, FoodEvent.current()):
- Read upRead up
- Create a ticketCreate a ticket
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"