Showing 226 of 226 total issues
Similar blocks of code found in 8 locations. Consider refactoring. Open
primary: {
50: 'rgb(var(--color-primary-50) / <alpha-value>)',
100: 'rgb(var(--color-primary-100) / <alpha-value>)',
200: 'rgb(var(--color-primary-200) / <alpha-value>)',
300: 'rgb(var(--color-primary-300) / <alpha-value>)',
- 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 61.
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 8 locations. Consider refactoring. Open
yellow: {
50: 'rgb(var(--color-yellow-50) / <alpha-value>)',
100: 'rgb(var(--color-yellow-100) / <alpha-value>)',
200: 'rgb(var(--color-yellow-200) / <alpha-value>)',
300: 'rgb(var(--color-yellow-300) / <alpha-value>)',
- 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 61.
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 8 locations. Consider refactoring. Open
focusColor: {
50: 'rgb(var(--color-focusColor-50) / <alpha-value>)',
100: 'rgb(var(--color-focusColor-100) / <alpha-value>)',
200: 'rgb(var(--color-focusColor-200) / <alpha-value>)',
300: 'rgb(var(--color-focusColor-300) / <alpha-value>)',
- 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 61.
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 8 locations. Consider refactoring. Open
orange: {
50: 'rgb(var(--color-orange-50) / <alpha-value>)',
100: 'rgb(var(--color-orange-100) / <alpha-value>)',
200: 'rgb(var(--color-orange-200) / <alpha-value>)',
300: 'rgb(var(--color-orange-300) / <alpha-value>)',
- 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 61.
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 8 locations. Consider refactoring. Open
blue: {
50: 'rgb(var(--color-blue-50) / <alpha-value>)',
100: 'rgb(var(--color-blue-100) / <alpha-value>)',
200: 'rgb(var(--color-blue-200) / <alpha-value>)',
300: 'rgb(var(--color-blue-300) / <alpha-value>)',
- 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 61.
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
Method create_branch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_branch(re_run)
# Create a branch with the name submission-<student_id>
branch_name_suffix = re_run ? "-#{Time.now.to_i}" : ""
branch_name = "submission-#{@submission.id}#{branch_name_suffix}"
repo_name = @submission.students.first.github_repository
- 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
Method execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute
unless (
target.visibility != Target::VISIBILITY_ARCHIVED &&
@assignment.milestone
)
- 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
Method execute
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(re_run: false)
unless github_configuration.configured? &&
@submission.target.action_config.present?
return
end
Method sign_in_at_oauth_origin
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sign_in_at_oauth_origin
if user.present?
user.regenerate_login_token
encrypted_token =
Method courses
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def courses
if current_user.blank?
current_school
.courses
.live
Method average_grades
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def average_grades
@average_grades ||=
begin
averaged =
TimelineEventGrade
Method validate
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(_object, context, value)
target = Target.find_by(id: value[:target_id])
assignment = target.assignments.not_archived.first
course = target.course
student =
Method courses
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def courses
@courses ||=
begin
if current_school_admin.present?
current_school
Method targets
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def targets(role: nil)
@targets ||=
begin
scope =
course.targets.live.includes(
Method applicable_submissions
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def applicable_submissions
stage_1 = course.timeline_events.not_auto_verified.live
# Filter by target
stage_2 =
Method create_quiz
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_quiz(assignments)
assignments.each do |old_assignment, new_assignment|
next unless old_assignment.quiz?
# create quiz
Method prepare_courses
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_courses
cohorts = @organisation.cohorts.includes(:course).uniq
courses =
cohorts.each_with_object({}) do |cohort, courses|
Method save_report
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save_report
SubmissionReport.transaction do
report =
SubmissionReport.find_by(
submission_id: @params[:submission_id],
Method create_video_resource
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_video_resource(size, name, description)
data = {
upload: {
approach: 'tus',
size: size
Function captureUnhandledRejections
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
captureUnhandledRejections: function (r, e, o) {
if (r) {
"function" == typeof r._rollbarURH &&
r._rollbarURH.belongsToShim &&
r.removeEventListener("unhandledrejection", r._rollbarURH);