nus-mtp/cs-modify

View on GitHub

Showing 2,705 of 2,705 total issues

Function get_all_mods_taken_together has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_all_mods_taken_together(aysem=None):
    '''
        Retrieves the list of all modules taken together in the same semester.

        Returns a table of lists. Each list contains
Severity: Minor
Found in components/database.py - About 35 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_mods_no_one_take has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_mods_no_one_take(aysem):
    '''
        Retrieves the list of all modules which no student take together
        in the specified semester.

Severity: Minor
Found in components/database.py - About 35 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def GET(self):
        '''
            This function is called when /starModule is accessed.
        '''
        web.header('X-Frame-Options', 'SAMEORIGIN')
Severity: Minor
Found in components/handlers/star_modules.py - About 35 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_mod_specified_class_size has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

def get_mod_specified_class_size(given_aysem, quota_lower, quota_higher):
    '''
        Retrieves the list of modules with quota/class size in the
        specified AY-Semester if the quota falls within the given range
        of quota_lower <= retrieved module quota <= quota_higher
Severity: Minor
Found in components/database.py - About 35 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

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

def check_code(code_str):
    #check if code_str matches code pattern
    '''
        Args:
        param (str): string representing code
Severity: Minor
Found in components/check_string.py and 1 other location - About 35 mins to fix
components/check_string.py on lines 21..30

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 33.

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

            hashed_id = hashlib.sha512(username + session[0][0]).hexdigest()
Severity: Minor
Found in components/database.py and 1 other location - About 35 mins to fix
components/database.py on lines 1831..1831

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 33.

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

        hashed_pass = hashlib.sha512(unhashed_pass + admin[0][0]).hexdigest()
Severity: Minor
Found in components/database.py and 1 other location - About 35 mins to fix
components/database.py on lines 1865..1865

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 33.

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

def check_name(name_str):
    '''
        Args:
        param (str): string representing the name

Severity: Minor
Found in components/check_string.py and 1 other location - About 35 mins to fix
components/check_string.py on lines 8..18

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 33.

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

Avoid too many return statements within this function.
Open

                            return False
Severity: Major
Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

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

        } else if (input.validity.valueMissing == true) {
            input.setCustomValidity("Please fill in your User ID.");
        } else {
            input.setCustomValidity("");
        }
    Severity: Minor
    Found in static/javascripts/csmodify.js and 1 other location - About 30 mins to fix
    static/javascripts/csmodify.js on lines 120..124

    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 45.

    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

    Avoid too many return statements within this function.
    Open

                    return Outcome().POST("delete_module", True, module_code)
    Severity: Major
    Found in components/handlers/delete_module.py - About 30 mins to fix

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

          if (input.validity.valueMissing == true) {
              input.setCustomValidity("Please enter a password.");
          } else {
              input.setCustomValidity("");
          }
      Severity: Minor
      Found in static/javascripts/csmodify.js and 1 other location - About 30 mins to fix
      static/javascripts/csmodify.js on lines 112..116

      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 45.

      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

      Avoid too many return statements within this function.
      Open

                                      return False
      Severity: Major
      Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                                        return Outcome().POST("edit_all_mountings_and_quotas", False, None)
        Severity: Major
        Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                              return False
          Severity: Major
          Found in components/helper.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                        return Outcome().POST("edit_all_mountings_and_quotas", False, None)
            Severity: Major
            Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return input_data
              Severity: Major
              Found in components/helper.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return Outcome().POST("edit_all_mountings_and_quotas", False, None)
                Severity: Major
                Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                      return Outcome().POST("edit_all_mountings_and_quotas", False, None)
                  Severity: Major
                  Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return Outcome().POST("edit_all_mountings_and_quotas", True, None)
                    Severity: Major
                    Found in components/handlers/edit_all_mountings_and_quotas.py - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language