nus-mtp/cs-modify

View on GitHub

Showing 2,705 of 2,705 total issues

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

            if ay_sem[9:14] == "Sem 1":
                if fixed_sem_1_mounting_value == 1 and tenta_mounting_value == -1:
                    ay_sem_plan[1] = 0
Severity: Minor
Found in components/handlers/module_overview.py and 1 other location - About 30 mins to fix
components/handlers/module_overview.py on lines 88..90

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

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

            elif ay_sem[9:14] == "Sem 2":
                if fixed_sem_2_mounting_value == 1 and tenta_mounting_value == -1:
                    ay_sem_plan[1] = 0
Severity: Minor
Found in components/handlers/module_overview.py and 1 other location - About 30 mins to fix
components/handlers/module_overview.py on lines 85..87

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

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

function toggleFilters() {
    var elements = document.getElementsByClassName("filter")
    if (elements[0].hasAttribute("hidden")) {
        document.getElementById("chevron").className="glyphicon glyphicon-chevron-up"
        for(var i=0; i < elements.length; i++) {
Severity: Minor
Found in static/javascripts/moduleListing.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 replace_null_with_dash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def replace_null_with_dash(table):
    '''
        Changes all the NULL values found in the table to '-'
        This function supports a 2D table.
    '''
Severity: Minor
Found in components/helper.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_quota_of_target_tenta_ay_sem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_quota_of_target_tenta_ay_sem(code, ay_sem):
    '''
        Get the quota of a mod in a target tentative AY/Sem (if any)
    '''
    number_of_attempts = 0
Severity: Minor
Found in components/database.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_quota_of_target_fixed_ay_sem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def get_quota_of_target_fixed_ay_sem(code, ay_sem):
    '''
        Get the quota of a mod in a target fixed AY/Sem (if any)
    '''
    number_of_attempts = 0
Severity: Minor
Found in components/database.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 load_fixed_mounting_plan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load_fixed_mounting_plan(self, module_code):
        '''
            Loads the fixed mounting plan of the single module
        '''
        fixed_mounting_and_quota = model.get_fixed_mounting_and_quota(module_code)
Severity: Minor
Found in components/handlers/module_overview.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 highlightErrorFieldsPreclusion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function highlightErrorFieldsPreclusion(data) {
    var modulesWithErrors = data;

    var rows = document.getElementsByTagName("tbody")[0].children;
    var message_start = "<p><b>";
Severity: Minor
Found in static/javascripts/csmodify.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

Adjoining classes: .btn-primary.disabled
Open

.btn-primary.disabled,

Adjoining classes: .btn-primary.disabled:focus
Open

.btn-primary.disabled:focus,

Adjoining classes: .btn-primary.disabled:active
Open

.btn-primary.disabled:active,

Adjoining classes: .btn-danger.disabled
Open

.btn-danger.disabled,

Adjoining classes: .btn.active
Open

.btn.active {

Rule doesn't have all its properties in alphabetical order.
Open

.btn-success {

Adjoining classes: .btn-success.disabled:focus
Open

.btn-success.disabled:focus,

Expected (<filter-function-list> | none) but found 'progid:DXImageTransform.Microsoft.gradient(enabledenabled =falsefalse)'.</filter-function-list>
Open

  filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);

Adjoining classes: fieldset[disabled] .btn-default.active
Open

fieldset[disabled] .btn-default.active {

Adjoining classes: .btn-primary.disabled:hover
Open

.btn-primary.disabled:hover,

Adjoining classes: .btn-success.active
Open

.btn-success.active,

Adjoining classes: .btn-warning.active
Open

.btn-warning.active,
Severity
Category
Status
Source
Language