Showing 226 of 226 total issues
Method rank_change_icon
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rank_change_icon(delta)
if delta >= 10
view.image_tag(
"courses/leaderboard/rank-change-up-double.svg",
alt:
Method execute
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute
submission =
TimelineEvent.transaction do
timeline_event_params =
(
Function wrap
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
(i.prototype.wrap = function (r, e, o) {
try {
var n;
if (
((n =
Method auth_callback
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def auth_callback
begin
crypt = EncryptorService.new
data =
- 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 loadFull
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
(i.prototype.loadFull = function (r, e, o, n, t) {
var l = !1,
i = e.createElement("script"),
s = e.getElementsByTagName("script")[0],
d = s.parentNode;
Method delete_content
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_content
quiz_questions =
QuizQuestion.joins(quiz: { assignment: :course }).where(
courses: {
id: @course.id
Function Home
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
return (
<Layout description="Description will go into a meta tag in <head />">
Method perform
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def perform(event_type, course, actor, resource)
webhook_endpoint = course.webhook_endpoint
unless event_type.in?(webhook_endpoint.events)
raise "#{event_type} was not one of the requested events in WebhookEndpoint##{webhook_endpoint.id}"
Method add_updates_for_coach
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_updates_for_coach(user)
coach = user.faculty
return [] if coach.blank?
Method student_rows
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def student_rows
rows =
students.map do |student|
user = student.user
Method targets
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def targets
attributes = %w[id title target_group_id sort_index]
scope =
@course
Function startRecording
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function startRecording() {
if (
navigator.mediaDevices &&
navigator.mediaDevices.getUserMedia &&
!state.recording
Method update_email
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_email
user =
Users::ValidateUpdateEmailTokenService.new(
params[:token],
current_school
Function setupShim
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupShim: function (r, e) {
if (r) {
var o = e.globalAlias || "Rollbar";
if ("object" == typeof r[o]) return r[o];
(r._rollbarShims = {}), (r._rollbarWrappedError = null);
Consider simplifying this complex logical expression. Open
if (r) {
"function" == typeof r._rollbarURH &&
r._rollbarURH.belongsToShim &&
r.removeEventListener("unhandledrejection", r._rollbarURH);
var n = function (r) {
Consider simplifying this complex logical expression. Open
if (
!r._rollbar_wrapped &&
((r._rollbar_wrapped = function () {
o && "function" == typeof o && o.apply(this, arguments);
try {
Method generate_url
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_url
signer =
Aws::CloudFront::UrlSigner.new(
key_pair_id: Rails.application.secrets.cloudfront[:key_pair_id],
private_key:
Similar blocks of code found in 8 locations. Consider refactoring. Open
red: {
50: 'rgb(var(--color-red-50) / <alpha-value>)',
100: 'rgb(var(--color-red-100) / <alpha-value>)',
200: 'rgb(var(--color-red-200) / <alpha-value>)',
300: 'rgb(var(--color-red-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
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
gray: {
50: 'rgb(var(--color-gray-50) / <alpha-value>)',
100: 'rgb(var(--color-gray-100) / <alpha-value>)',
200: 'rgb(var(--color-gray-200) / <alpha-value>)',
300: 'rgb(var(--color-gray-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