Showing 122 of 226 total issues
File rollbar.js
has 430 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
var _rollbarConfig = {
accessToken: window.pupilfirst.rollbar.accessToken,
captureUncaught: window.pupilfirst.rollbar.captureUncaught,
captureUnhandledRejections:
window.pupilfirst.rollbar.captureUnhandledRejections,
Class AppRouterPresenter
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class AppRouterPresenter < ::ApplicationPresenter
def initialize(view_context, course)
@course = course
super(view_context)
end
Function audioRecorder
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function audioRecorder(authenticity_token, attachingCB) {
const [state, setState] = useState({
recording: false,
url: undefined,
blob: undefined,
File details_service.rb
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Targets
class DetailsService
include RoutesResolvable
def initialize(target, student, public_preview:)
Class StudentPresenter
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class StudentPresenter < ApplicationPresenter
def initialize(view_context, student)
@student = student
super(view_context)
end
Class LeaderboardPresenter
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class LeaderboardPresenter < ApplicationPresenter
class Student < SimpleDelegator
attr_reader :score, :rank
attr_accessor :delta
Consider simplifying this complex logical expression. Open
Open
if (r) {
var o = e.globalAlias || "Rollbar";
if ("object" == typeof r[o]) return r[o];
(r._rollbarShims = {}), (r._rollbarWrappedError = null);
var l = new c(e);
Class ApplicationController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
include Pundit::Authorization
# Prevent CSRF attacks by raising an exception. Note that this is different from the default of :null_session.
# Rails 5 introduced a boolean option called prepend for maintaining the order of execution
Class CurriculumPresenter
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CurriculumPresenter < ApplicationPresenter
def initialize(view_context, course)
@course = course
super(view_context)
end
File curriculum_presenter.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Courses
class CurriculumPresenter < ApplicationPresenter
def initialize(view_context, course)
@course = course
super(view_context)
Method filter
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def filter
@filter ||=
begin
milestone_targets_data =
milestone_targets
Class SubmissionDetailsResolver
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SubmissionDetailsResolver < ApplicationQuery
property :submission_id
def submission_details
{
Class User
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class User < ApplicationRecord
acts_as_taggable
belongs_to :school
belongs_to :organisation, optional: true
Class Target
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Target < ApplicationRecord
# Use to allow changing visibility of a target. See Targets::UpdateVisibilityService.
attr_accessor :safe_to_change_visibility
STATUS_COMPLETE = :complete
Method auth_callback
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def auth_callback
begin
crypt = EncryptorService.new
data =
Method students
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def students
scope = course.students
scope =
if current_school_admin.present? &&
Method students
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def students
scope = course.students
scope =
if current_school_admin.present? &&
- 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 details
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def details
details = default_props
if @student.present?
details =
details.update(
Method comments_for_submissions
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def comments_for_submissions
#TODO - clean up this code using the list of attributes
reaction_attributes = [
:id,
:user_id,
Function notify
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const notify = (title, text, type) => {
let notificationText = text;
let textTrusted = false;
let reloadRequired = false;