Showing 259 of 471 total issues
Method initialize
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
super(user)
can :vote_in, ::Poll do |poll|
user.is_logged_in? &&
- 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
Class ApplicationSerializer
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationSerializer < ActiveModel::Serializer
embed :ids, include: true
def scope
super || {}
Class User
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
include CustomCounterCache::Model
include ReadableUnguessableUrls
include MessageChannel
include HasExperiences
ThreadLoader
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
export default class ThreadLoader {
constructor(discussion) {
this.discussion = discussion;
this.reset();
}
File poll_model.js
has 343 lines of code (exceeds 250 allowed). Consider refactoring. Open
import BaseModel from '@/shared/record_store/base_model';
import AppConfig from '@/shared/services/app_config';
import Session from '@/shared/services/session';
import HasDocuments from '@/shared/mixins/has_documents';
import HasTranslations from '@/shared/mixins/has_translations';
NullGroupModel
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
export default class NullGroupModel {
static singular = 'group';
static plural = 'groups';
static subscription = {};
File html_diff.js
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
var Match, calculate_operations, consecutive_where, create_index, diff, find_match, find_matching_blocks, html_to_tokens, is_end_of_tag, is_start_of_tag, is_tag, is_whitespace, isnt_tag, op_map, recursively_find_matching_blocks, render_operations, wrap;
is_end_of_tag = function(char) {
return char === '>';
};
File thread_service.js
has 330 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Session from '@/shared/services/session';
import Records from '@/shared/services/records';
import Flash from '@/shared/services/flash';
import EventBus from '@/shared/services/event_bus';
import AbilityService from '@/shared/services/ability_service';
Class ProfileController
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class API::V1::ProfileController < API::V1::RestfulController
before_action :require_current_user, only: [:index, :contactable]
def index
ids = UserQuery.invitable_user_ids(model: nil, actor: current_user, user_ids: params[:xids].split('x').map(&:to_i).compact)
File user.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
class User < ApplicationRecord
include CustomCounterCache::Model
include ReadableUnguessableUrls
include MessageChannel
include HasExperiences
Function addActions
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
addActions(group) {
return {
matrix: {
name: 'chatbot.matrix',
icon: 'mdi-matrix',
File ninties_movies_helper.rb
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Dev::NintiesMoviesHelper
include Dev::FakeDataHelper
private
Function actions
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
actions(discussionTemplate, group) {
return {
edit_default_template: {
name: 'poll_common.edit_template',
icon: 'mdi-pencil',
Function actions
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
actions(pollTemplate, group) {
return {
edit_default_template: {
name: 'poll_common.edit_template',
icon: 'mdi-pencil',
Class Discussion
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Discussion < ApplicationRecord
include CustomCounterCache::Model
include ReadableUnguessableUrls
include Translatable
include Reactable
Method initialize
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
super(user)
can [:show], ::Group do |group|
!group.archived_at &&
- 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 publish_event!
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.publish_event!(event_id)
event = Event.find(event_id)
event.reload
return if event.eventable.nil?
- 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 calculate_results
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.calculate_results(poll, poll_options)
sorted_poll_options = case poll.order_results_by
when 'priority'
poll_options.sort_by {|o| o.priority }
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"
Further reading
Class Stance
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Stance < ApplicationRecord
include CustomCounterCache::Model
include HasMentions
include Reactable
include HasEvents
Method default_templates
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.default_templates
AppConfig.poll_templates.map do |key, raw_attrs|
raw_attrs[:key] = key
attrs = {}
- 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"