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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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++) {
- Read upRead up
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.
'''
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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)
- Read upRead up
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>";
- Read upRead up
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,
- Exclude checks
Adjoining classes: .btn-primary.disabled:focus Open
.btn-primary.disabled:focus,
- Exclude checks
Adjoining classes: .btn-primary.disabled:active Open
.btn-primary.disabled:active,
- Exclude checks
Adjoining classes: .btn-danger.disabled Open
.btn-danger.disabled,
- Exclude checks
Adjoining classes: .btn.active Open
.btn.active {
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.btn-success {
- Exclude checks
Adjoining classes: .btn-success.disabled:focus Open
.btn-success.disabled:focus,
- Exclude checks
Expected (<filter-function-list> | none) but found 'progid:DXImageTransform.Microsoft.gradient(enabledenabled =falsefalse)'.</filter-function-list> Open
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
- Exclude checks
Adjoining classes: fieldset[disabled] .btn-default.active Open
fieldset[disabled] .btn-default.active {
- Exclude checks
Adjoining classes: .btn-primary.disabled:hover Open
.btn-primary.disabled:hover,
- Exclude checks
Adjoining classes: .btn-success.active Open
.btn-success.active,
- Exclude checks
Adjoining classes: .btn-warning.active Open
.btn-warning.active,
- Exclude checks