uclouvain/osis-dissertation

View on GitHub

Showing 20 of 75 total issues

Function get_next_status has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring.
Open

def get_next_status(dissert, operation):
    if operation == "go_forward":
        if dissert.status == 'DRAFT' or dissert.status == 'DIR_KO':
            return 'DIR_SUBMIT'

Severity: Minor
Found in models/dissertation.py - About 3 hrs 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 manager_dissertations_detail has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

def manager_dissertations_detail(request, pk):
    dissert = dissertation.find_by_id(pk)
    if dissert is None:
        return redirect('manager_dissertations_list')
    person = mdl.person.find_by_user(request.user)
Severity: Minor
Found in views/dissertation.py - About 2 hrs 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 add has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def add(person, type_arg, available_by_email, available_by_phone, available_at_office, comment):
Severity: Minor
Found in models/adviser.py - About 45 mins to fix

    Function proposition_dissertation_edit has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

    def proposition_dissertation_edit(request, pk):
        proposition = proposition_dissertation.find_by_id(pk)
        if proposition is None:
            return redirect('proposition_dissertations')
        adv = get_current_adviser(request)
    Severity: Minor
    Found in views/proposition_dissertation.py - About 45 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

    Consider simplifying this complex logical expression.
    Open

            if offer_prop.validation_commission_exists and dissert.status == 'DIR_SUBMIT':
    
                return 'COM_SUBMIT'
    
            elif offer_prop.evaluation_first_year and (dissert.status == 'DIR_SUBMIT' or
    Severity: Major
    Found in models/dissertation.py - About 40 mins to fix

      Function search has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def search(terms, active=None, visibility=None, connected_adviser=None, education_groups=None):
      Severity: Minor
      Found in models/proposition_dissertation.py - About 35 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 'COM_SUBMIT'
        Severity: Major
        Found in models/dissertation.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 'EVA_SUBMIT'
          Severity: Major
          Found in models/dissertation.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 'DIR_KO'
            Severity: Major
            Found in models/dissertation.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return dissert.status
              Severity: Major
              Found in models/dissertation.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return dissert.status
                Severity: Major
                Found in models/dissertation.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return 'EVA_KO'
                  Severity: Major
                  Found in models/dissertation.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return dissert.status
                    Severity: Major
                    Found in models/dissertation.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return 'TO_RECEIVE'
                      Severity: Major
                      Found in models/dissertation.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return 'TO_RECEIVE'
                        Severity: Major
                        Found in models/dissertation.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return 'ENDED_LOS'
                          Severity: Major
                          Found in models/dissertation.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return 'ENDED_WIN'
                            Severity: Major
                            Found in models/dissertation.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return 'COM_KO'
                              Severity: Major
                              Found in models/dissertation.py - About 30 mins to fix

                                Function informations_add has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                                Open

                                def informations_add(request):
                                    if request.method == "POST":
                                        if 'search_form' in request.POST:  # step 2 : second form to select person in list
                                            return _manage_search_form(request)
                                
                                
                                Severity: Minor
                                Found in views/information.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 manager_informations_add has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring.
                                Open

                                def manager_informations_add(request):
                                    if request.method == "POST":
                                        if 'search_form' in request.POST:  # step 2 : second form to select person in list
                                            return _manage_search_form(request, manager=True)
                                        else:  # step 3 : everything ok, register the person as adviser
                                Severity: Minor
                                Found in views/information.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