Showing 20 of 58 total issues
File profile_helper.py
has 467 lines of code (exceeds 250 allowed). Consider refactoring. Open
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
from django.core.exceptions import (
File settings.py
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
# MIT License
# Copyright (c) 2017 MassChallenge, Inc.
import datetime
import os
File office_hours_calendar_view.py
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import (
datetime,
timedelta,
)
File reserve_office_hour_view.py
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
from pytz import timezone
from django.contrib.auth import get_user_model
from django.db.models import Q
from django.template import loader
Function has_object_permission
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def has_object_permission(self, request, view, obj):
model = view.kwargs.get('model', '').lower()
related_model = view.kwargs.get('related_model', '').lower()
model_name = model_name_case(model, related_model)
app_label = obj._meta.app_label
- 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 _get_filters
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _get_filters(request):
if is_employee(request.user):
return []
if request.GET['index'] == 'startup':
- 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 _created_datetimes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _created_datetimes(self, instance):
if instance.created_at is not None:
self.earliest = instance.created_at
elif hasattr(instance, "created_datetime"):
if instance.created_datetime is not 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 application_criteria_read_state
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def application_criteria_read_state(self, feedbacks):
if not self.application_criteria_read_state_cache:
ids_cache_value = {}
db_values = feedbacks.values(
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function get_calendar_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_calendar_data(self, counterpart_name):
if hasattr(self, "calendar_data"):
return self.calendar_data
name = counterpart_name
if self.mentor_recipient:
- 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
Avoid deeply nested control flow statements. Open
if not get_user(request).has_perm(permission_code):
return False # pragma: no cover
# some other value is in place,
# so we don't require permissions
return True
Function confirmed_user_program_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def confirmed_user_program_data(program_family_data):
program_family_to_date_created = {}
for program_family in program_family_data:
location = program_family["location"]
created_at = program_family["created_at"]
- 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 _extract_user
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _extract_user(self, request):
user_id = request.data.get("user_id", None)
if user_id is not None and user_id != request.user.id:
try:
self.target_user = User.objects.get(pk=user_id)
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function map_data
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def map_data(klass, query, order, data_keys, output_keys):
Avoid too many return
statements within this function. Open
return IS_CONFIRMED_MENTOR_FILTER
Function analysis_tally
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def analysis_tally(self, app_id, db_value, cache, **kwargs):
if not self.reads_options:
options = self.subject.criterionoptionspec_set.values_list(
'option', flat=True).distinct()
- 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 analysis_tally
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def analysis_tally(self, app_id, db_value, cache, **kwargs):
apps = kwargs.get("apps")
if not self._app_ids_to_pf_name and apps.count() > 0:
self.calc_app_ids_to_targets(apps)
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 _extract_startup
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _extract_startup(self, request):
startup_id = request.data.get("startup_id", None)
if startup_id is None:
self.startup = None
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 validate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate(self, attrs):
start_date_time = None
end_date_time = None
if self.instance is not None:
start_date_time = self.instance.start_date_time
- 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"