nus-mtp/cs-modify

View on GitHub

Showing 2,705 of 2,705 total issues

Avoid deeply nested control flow statements.
Open

                        if sem2_quota == '?' or sem2_quota == '-':
                            oversub_amount = sem2_num_students
                        else:
                            oversub_amount = sem2_num_students - sem2_quota
                        list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
Severity: Major
Found in components/handlers/oversub_mod.py - About 45 mins to fix

    Function convertToDataPrerequisite has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function convertToDataPrerequisite() {
        var prerequisites = [];
        // For iterating through units comprising of
        // [[Module-columns],[AND-column]]
        var rows = document.getElementsByTagName("tbody")[0].children;
    Severity: Minor
    Found in static/javascripts/csmodify.js - 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

    Function validate_input has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def validate_input(input_data, input_types, is_future=False,
    Severity: Minor
    Found in components/model.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if not outcome:
                              is_successful = False
                              error_code_and_msg = [module, ERROR_MSG_MODULE_DOESNT_EXIST]
                              error_list.append(error_code_and_msg)
                          else:
      Severity: Major
      Found in components/database.py - About 45 mins to fix

        Function validate_input has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def validate_input(input_data, input_types, is_future=False,
        Severity: Minor
        Found in components/helper.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if outcome == "has_mounting":
                                      outcome_message += "Module " + module_code + " has " +\
                                                         "mountings that refer to it. " +\
                                                         "Please remove all mountings before deleting " +\
                                                         "the module."
          Severity: Major
          Found in components/handlers/outcome.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if sem1_quota == '?' or sem1_quota == '-':
                                        oversub_amount = sem1_num_students
                                    else:
                                        oversub_amount = sem1_num_students - sem1_quota
                                    list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
            Severity: Major
            Found in components/handlers/oversub_mod.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if sem1_quota == '?' or sem1_quota == '-':
                                          oversub_amount = sem1_num_students
                                      else:
                                          oversub_amount = sem1_num_students - sem1_quota
                                      list_of_oversub_mod.append((module_code, module_name, target_ay_sem,
              Severity: Major
              Found in components/handlers/oversub_mod.py - About 45 mins to fix

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                    window.onclick = function(event) {
                      if (event.target == modal) {
                          modal.style.display = "none";
                      }
                    }
                Severity: Major
                Found in static/javascripts/individualModuleInfo.js and 2 other locations - About 40 mins to fix
                static/javascripts/modulesTakenPriorToOthers.js on lines 40..44
                static/javascripts/viewModule.js on lines 124..128

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                    window.onclick = function(event) {
                        if (event.target == modal) {
                            modal.style.display = "none";
                        }
                    }
                Severity: Major
                Found in static/javascripts/modulesTakenPriorToOthers.js and 2 other locations - About 40 mins to fix
                static/javascripts/individualModuleInfo.js on lines 134..138
                static/javascripts/viewModule.js on lines 124..128

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 3 locations. Consider refactoring.
                Open

                  window.onclick = function(event) {
                      if (event.target == modal) {
                          modal.style.display = "none";
                      }
                  }
                Severity: Major
                Found in static/javascripts/viewModule.js and 2 other locations - About 40 mins to fix
                static/javascripts/individualModuleInfo.js on lines 134..138
                static/javascripts/modulesTakenPriorToOthers.js on lines 40..44

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 49.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Consider simplifying this complex logical expression.
                Open

                                    if ((sem2_quota != '?' and sem2_quota != '-') \
                                        and sem2_num_students > sem2_quota) \
                                        or ((sem2_quota == '?' or sem2_quota == '-') and sem2_num_students > 0):
                                        if sem2_quota == '?' or sem2_quota == '-':
                                            oversub_amount = sem2_num_students
                Severity: Major
                Found in components/handlers/oversub_mod.py - About 40 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                                      if ((sem1_quota != '?' and sem1_quota != '-') \
                                          and sem1_num_students > sem1_quota) \
                                          or ((sem1_quota == '?' or sem1_quota == '-') and sem1_num_students > 0):
                                          if sem1_quota == '?' or sem1_quota == '-':
                                              oversub_amount = sem1_num_students
                  Severity: Major
                  Found in components/handlers/oversub_mod.py - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                        if ((sem1_quota != '?' and sem1_quota != '-') \
                                            and sem1_num_students > sem1_quota) \
                                            or ((sem1_quota == '?' or sem1_quota == '-') and sem1_num_students > 0):
                                            if sem1_quota == '?' or sem1_quota == '-':
                                                oversub_amount = sem1_num_students
                    Severity: Major
                    Found in components/handlers/oversub_mod.py - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                                          if ((sem2_quota != '?' and sem2_quota != '-') \
                                              and sem2_num_students > sem2_quota) \
                                              or ((sem2_quota == '?' or sem2_quota == '-') and sem2_num_students > 0):
                                              if sem2_quota == '?' or sem2_quota == '-':
                                                  oversub_amount = sem2_num_students
                      Severity: Major
                      Found in components/handlers/oversub_mod.py - About 40 mins to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                        try:
                                            sem2_mounting = input_data[module_code+"_Sem2Mounting"]
                                            sem2_mounting = True
                                        except KeyError:
                                            sem2_mounting = False
                        Severity: Minor
                        Found in components/handlers/edit_all_mountings_and_quotas.py and 1 other location - About 40 mins to fix
                        components/handlers/edit_all_mountings_and_quotas.py on lines 64..68

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 34.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                                        try:
                                            sem1_mounting = input_data[module_code+"_Sem1Mounting"]
                                            sem1_mounting = True
                                        except KeyError:
                                            sem1_mounting = False
                        Severity: Minor
                        Found in components/handlers/edit_all_mountings_and_quotas.py and 1 other location - About 40 mins to fix
                        components/handlers/edit_all_mountings_and_quotas.py on lines 69..73

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 34.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

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

                        function checkMountingChange(element, oldMounting, oldQuota, mountingID, quotaID) {
                        Severity: Minor
                        Found in static/javascripts/editAll.js - About 35 mins to fix

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

                          def add_module(code, name, description, module_credits, status):
                          Severity: Minor
                          Found in components/model.py - About 35 mins to fix

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

                            def add_module(code, name, description, module_credits, status):
                            Severity: Minor
                            Found in components/database.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language