MAKENTNU/web

View on GitHub

Showing 86 of 230 total issues

Function addVoterPost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function addVoterPost($element, pk, forced) {
    $.ajaxSetup({
        beforeSend: function (xhr, settings) {
            xhr.setRequestHeader("X-CSRFToken", csrfToken);
        },
Severity: Minor
Found in src/checkin/static/checkin/js/suggest_skill.js - About 25 mins to fix

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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request):
        scan_exists = RegisterProfile.objects.exists()
        response_dict = {
            'scan_exists': scan_exists,
            'scan_is_recent': False,
Severity: Minor
Found in src/checkin/api/views.py - About 25 mins to fix

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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def post(self, request):
        """
        Handles the request from the RFID card reader.
        Does a basic check for a valid card id.

Severity: Minor
Found in src/card/views.py - About 25 mins to fix

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_context_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_context_data(self, **kwargs):
        user = self.request.user
        profile, _created = Profile.objects.get_or_create(user=user)

        completed_3d_printer = hasattr(user, 'printer_3d_course')
Severity: Minor
Found in src/checkin/views.py - About 25 mins to fix

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 isValidForRules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function isValidForRules(rules, startTime, endTime) {
    /**
     * Checks if the period [startTime, endTime] is valid for the given set of rules
     */
    const coveredRules = getRulesCovered(rules, startTime, endTime);
Severity: Minor
Found in src/make_queue/static/make_queue/js/reservation_rule_utils.js - About 25 mins to fix

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 form_invalid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def form_invalid(self, form):
        if '__all__' in form.errors:
            for error in form.errors['__all__'].data:
                if error.code == 'warning_message':
                    messages.add_message(self.request, messages.WARNING, error.message)
Severity: Minor
Found in src/internal/views.py - About 25 mins to fix

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

Severity
Category
Status
Source
Language