Showing 86 of 230 total issues
Function validate
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def validate(self):
# User needs to be able to print, for it to be able to reserve the printers
if not self.machine.can_user_use(self.user):
return False
- 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 showDetailedMemberInformation
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showDetailedMemberInformation(member) {
/**
* Displays the selected members' information in a popup modal.
*/
const textAttributeNamesToValues = {
Function modifyToFirstValid
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function modifyToFirstValid(rules, startTime, endTime, modificationDirection) {
/**
* Modifies either startTime (modificationDirection 0) or endTime (modificationDirection 1) until the period
* [startTime, endTime] is valid for the given set of rules.
*/
- 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 setup
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setup() {
/**
* Setup of the global state and actions.
*/
$filterStatusInput.change(() => {
Function compile_fieldsets
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def compile_fieldsets(self, custom_fieldsets: Iterable[dict], form: Form):
fieldsets = []
for fieldset in copy.deepcopy(custom_fieldsets):
if not fieldset:
continue
- 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 setUpSelection
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReservationCalendar.prototype.setUpSelection = function () {
/**
* Creates all object fields required for selection and all event handlers for clicks, touches and drags.
* The selectionStart field holds the first tap and the selectionEnd field holds the hovered value.
*/
Function post
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def post(self, request):
suggestion = request.POST.get('suggested-skill')
suggestion_english = request.POST.get('suggested-skill-english')
profile = request.user.profile
image = request.FILES.get('image')
- 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 modifyToFirstValid
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
function modifyToFirstValid(rules, startTime, endTime, modificationDirection) {
/**
* Modifies either startTime (modificationDirection 0) or endTime (modificationDirection 1) until the period
* [startTime, endTime] is valid for the given set of rules.
*/
Function mazeMapSearch
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
mazeMapSearch: function () {
// Data attributes set by the widget
const campusID = this.data("campus-id");
const maxResults = this.data("max-results");
const urlField = this.data("url-field");
Function updateDisplay
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateDisplay() {
const startIndex = state.page * state.elementsPerPage;
const endIndex = (state.page + 1) * state.elementsPerPage;
let numRegistrationsFiltered = 0;
Function clean
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def clean(self, data: InMemoryUploadedFile | bool | None, initial: ImageFieldFile = None):
cleaned_data: ImageFieldFile | InMemoryUploadedFile | TemporaryUploadedFile | bool | None = super().clean(data, initial=initial)
if data and cleaned_data:
try:
if initial and file_contents_equal(cleaned_data, initial):
- 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 updateDisplay
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function updateDisplay() {
const startIndex = state.page * state.elementsPerPage;
const endIndex = (state.page + 1) * state.elementsPerPage;
let numRegistrationsFiltered = 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 setUpState
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setUpState() {
$("tbody tr").each(function () {
state.elements.push({
pk: $(this).data("pk"),
name: $(this).data("name").toLowerCase(),
Function registerProfilePost
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function registerProfilePost($element) {
$.ajaxSetup({
beforeSend: function (xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", csrfToken);
},
Function updateSelection
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReservationCalendar.prototype.updateSelection = function () {
/**
* Updates the shown selection.
*/
const calendar = this;
Function get_error_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_error_message(self, form, reservation):
"""
Generates the correct error message for the given form.
:param reservation: The reservation to generate an error message for
- 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 getPeriodIn
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function getPeriodIn(rules, date, direction) {
date = (date.getDay() + 6) % 7 + date.getHours() / 24 + date.getMinutes() / (24 * 60);
for (const rule of rules) {
for (const period of rule.periods) {
if (direction === 1 && period[0] === date) {
- 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 selectionPopupContent
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
ReservationCalendar.prototype.selectionPopupContent = function () {
/**
* Creates the default content for the popup after selection is finished. The content produced is a simple card with
* information about the selection and a button to create a reservation using the selection.
*/
Function clean
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
cleaned_data = super().clean()
start_time = cleaned_data.get('start_time')
end_time = cleaned_data.get('end_time')
days_changed = cleaned_data.get('days_changed')
- 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_user_details_from_user_field
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _get_user_details_from_user_field(field_name: str, field_value: str, use_cached: bool) -> dict[str, str]:
user_details = {}
if use_cached:
user = User.objects.filter(**{field_name: field_value}).first()
if user:
- 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"