nus-mtp/cs-modify

View on GitHub

Showing 75 of 2,705 total issues

File database.py has 1712 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''
    database.py
    Contains functions that directly communicate with or manipulate the database
'''
import hashlib
Severity: Major
Found in components/database.py - About 4 days to fix

    Function validate_input has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_input(input_data, input_types, is_future=False,
                       aysem_specific=True, attr_required=True, show_404=True):
        '''
            Validates that the GET input data (in the URL) is valid.
    
    
    Severity: Minor
    Found in components/helper.py - About 2 days 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 97 (exceeds 5 allowed). Consider refactoring.
    Open

        def POST(self, *test_data):
            '''
                Handles the editing operations for all mountings and quotas
            '''
            if test_data:
    Severity: Minor
    Found in components/handlers/edit_all_mountings_and_quotas.py - About 1 day 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 has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
    Open

        def GET(self, *test_data):
            '''
                Renders the oversubscribed modules page if users requested
                for the page through the GET method.
            '''
    Severity: Minor
    Found in components/handlers/oversub_mod.py - About 1 day 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 78 (exceeds 5 allowed). Consider refactoring.
    Open

        def POST(self, *received_data):
            '''
                POST method will check the type of action executed by the user,
                and display the corresponding message based on the execution's outcome.
            '''
    Severity: Minor
    Found in components/handlers/outcome.py - About 1 day 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

    File csmodify.js has 558 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /****************************************************************/
    /* =============== CS-MODIFY JAVASCRIPT FILE ================== */
    /* This file serves as the central javascript source for all the*/
    /* custom-defined animations or interactions on the page.       */
    /****************************************************************/
    Severity: Major
    Found in static/javascripts/csmodify.js - About 1 day to fix

      File helper.py has 478 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      '''
          helper.py
          Contains functions that process and/or manipulate data that are OUTSIDE the database
      '''
      
      
      Severity: Minor
      Found in components/helper.py - About 7 hrs to fix

        Function onload has 123 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        window.onload = function () {
            studentYearBarChart = new CanvasJS.Chart("module-view-student-year-bar-chart",
            {
                animationEnabled: true,
                axisY: {
        Severity: Major
        Found in static/javascripts/individualModuleInfo.js - About 4 hrs to fix

          Function onload has 110 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          window.onload = function () {
              var chart = new CanvasJS.Chart("quota-demand-chart",
              {
                animationEnabled: true,
          
          
          Severity: Major
          Found in static/javascripts/viewModule.js - About 4 hrs to fix

            Function onload has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            window.onload = function () {
                studentYearBarChart = new CanvasJS.Chart("enrollment-student-year-bar-chart",
                {
                    animationEnabled: true,
                    axisY: {
            Severity: Major
            Found in static/javascripts/studentEnrollment.js - About 3 hrs to fix

              Function edit_prerequisite has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
              Open

              def edit_prerequisite(module_code, prereq_units):
                  '''
                      Changes the prerequisites of given module_code into a new
                      set of prerequisites found in prereq_units.
                      Returns true if successful, false otherwise.
              Severity: Minor
              Found in components/database.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 replaceNilQuotasWithNumbers has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              function replaceNilQuotasWithNumbers(elementID){
                  var table = $(elementID).DataTable();
                  var data = table
                      .rows()
                      .data();
              Severity: Minor
              Found in static/javascripts/fixedAndTentaMounting.js - 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 POST has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

                  def POST(self):
                      '''
                          Handles the submission of the 'Edit Specific Module Info' page
                      '''
                      input_data = model.validate_input(web.input(), ["code", "aysem"],
              Severity: Minor
              Found in components/handlers/module_edit.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 edit_preclusion has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

              def edit_preclusion(module_code, preclude_units):
                  '''
                      Changes the preclusions of given module_code into a new
                      set of preclusions found in preclude_units.
                      Returns true if successful, false otherwise.
              Severity: Minor
              Found in components/database.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 get_modules_with_modified_quota has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_modules_with_modified_quota(self):
                      '''
                          Get all modules whose quota has been modified in a future AY.
                          Return the module code, module name, current AY-Sem, target AY-Sem,
                          current AY-Sem's quota, target AY-Sem's quota, and quota change
              Severity: Minor
              Found in components/handlers/modified_modules.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 populate_module_ay_sem_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def populate_module_ay_sem_data(self, selected_ay):
                      '''
                          Populate each subplan with sem 1 and sem 2 mounting values
                      '''
                      tenta_full_mounting_plan = self.full_mounting_plan
              Severity: Minor
              Found in components/handlers/tentative_module_mountings.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 load_mounting_info has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def load_mounting_info(self, module_code, ay_sem):
                      '''
                          Load the mounting status and quota of the target module and AY/Sem
                      '''
                      fixed_mounting_status = -1
              Severity: Minor
              Found in components/handlers/module_view_in_ay_sem.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 load_tenta_mounting_plan has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def load_tenta_mounting_plan(self, module_code):
                      '''
                          Loads the tentative mounting plan of the single module
                      '''
                      tenta_mounting_and_quota = model.get_tenta_mounting_and_quota(module_code)
              Severity: Minor
              Found in components/handlers/module_overview.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 GET has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def GET(self):
                      '''
                          Renders the modified modules page if users requested
                          for the page through the GET method.
                      '''
              Severity: Minor
              Found in components/handlers/modified_modules.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 POST has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                  def POST(self, *test_data):
                      '''
                          Handles the restoration of module info
                      '''
                      if test_data:  # for testing purposes
              Severity: Minor
              Found in components/handlers/module_restore.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

              Severity
              Category
              Status
              Source
              Language