Showing 13 of 19 total issues
Class User
has 66 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class User < ApplicationRecord
include Mumuki::Domain::Syncable
include WithProfile,
WithUserNavigation,
WithReminders,
Class Exercise
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Exercise < ApplicationRecord
RANDOMIZED_FIELDS = [:default_content, :description, :extra, :hint, :test, :expectations, :custom_expectations]
BASIC_RESOURCE_FIELDS = %i(
name layout editor corollary teacher_info manual_evaluation locale
choices assistance_rules randomizations tag_list extra_visible goal
Class Assignment
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Assignment < Progress
include Contextualization
include WithMessages
include Gamified
Class Organization
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Organization < ApplicationRecord
include Mumuki::Domain::Syncable
include Mumuki::Domain::Helpers::Organization
include Mumuki::Domain::Area
Class IncognitoClass
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class IncognitoClass
def incognito?
true
end
Class Exam
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Exam < ApplicationRecord
include GuideContainer
include FriendlyName
include TerminalNavigation
Class Discussion
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Discussion < ApplicationRecord
include WithDiscussionStatus, WithScopedQueries, Contextualization, WithResponsibleModerator
belongs_to :item, polymorphic: true
has_many :messages, -> { order(:created_at) }, dependent: :destroy
Class ApplicationRecord
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
include WithPgLock
Class ExamRegistration
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ExamRegistration < ApplicationRecord
include WithTimedEnablement
include TerminalNavigation
belongs_to :organization
Method fields_schema
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.fields_schema
[
{name: :id, kind: :special},
{name: :name, kind: :special},
{name: :locale, kind: :metadata},
Method call
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def call
{
name: @info['name'],
comment_type: @info['comment_type'],
runner_url: @runner_url,
Method to_resource_h
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def to_resource_h
excluded_fields = %i(created_at exercise_id id organization_id parent_id solution submission_id
submission_status submitted_at submitter_id top_submission_status updated_at misplaced)
as_json(except: excluded_fields,
Method validate_accessible_for!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def validate_accessible_for!(user)
if user.present?
raise Mumuki::Domain::ForbiddenError unless authorized?(user)
raise Mumuki::Domain::GoneError unless enabled_for?(user)
else
- 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"