Showing 257 of 469 total issues
Method import
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.import(filename_or_url, reset_keys: false)
group_ids = []
migrate_ids = {}
if URI.parse(filename_or_url).class == URI::Generic
RestfulClient
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class RestfulClient {
constructor(resourcePlural = null) {
this.defaultParams = {};
this.currentUpload = null;
Class RecordCache
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class RecordCache
attr_accessor :scope
attr_accessor :exclude_types
attr_accessor :user_ids
attr_accessor :current_user_id
Method initialize
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(user)
super(user)
can [:show], ::Group do |group|
!group.archived_at &&
File discussion_model.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import BaseModel from '@/shared/record_store/base_model';
import AppConfig from '@/shared/services/app_config';
import Session from '@/shared/services/session';
import RangeSet from '@/shared/services/range_set';
import HasDocuments from '@/shared/mixins/has_documents';
Method accessible_records
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
Open
def accessible_records
load_and_authorize(:discussion)
records = Event.where(discussion_id: @discussion.id)
if %w[position_key sequence_id].include?(params[:order_by])
- 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
File poll_service.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class PollService
def self.create(poll:, actor:, params: {})
actor.ability.authorize! :create, poll
poll.assign_attributes(author: actor)
File group_export_service.rb
has 292 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class GroupExportService
RELATIONS = %w[
all_users
all_events
all_notifications
Class Event
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Event < ApplicationRecord
include ActionView::Helpers::SanitizeHelper
include CustomCounterCache::Model
include HasTimeframe
extend HasCustomFields
EventModel
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class EventModel extends BaseModel {
static singular = 'event';
static plural = 'events';
static indices = ['discussionId', 'sequenceId', 'position', 'depth', 'parentId', 'positionKey'];
static uniqueIndices = ['id'];
Class DiscussionsController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class API::V1::DiscussionsController < API::V1::RestfulController
def create
instantiate_resource
if resource_params[:forked_event_ids] && resource_params[:forked_event_ids].any?
EventService.move_comments(discussion: create_action.discussion, params: resource_params, actor: current_user)
File ability_service.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import AppConfig from '@/shared/services/app_config';
import Records from '@/shared/services/records';
import Session from '@/shared/services/session';
import LmoUrlService from '@/shared/services/lmo_url_service';
import {intersection} from 'lodash-es';
Function actions
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
actions(stance, vm, event) {
return {
react: {
dock: 1,
canPerform() {
File base_model.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import utils from './utils';
import Vue from 'vue';
import { isEqual } from 'date-fns';
import { camelCase, union, each, isArray, keys, filter, snakeCase, defaults, orderBy, assign, includes, pick } from 'lodash-es';
Method event
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def event(recipient_id, event_id)
@current_user = @recipient = User.find_by!(id: recipient_id)
@event = Event.find_by!(id: event_id)
@notification = Notification.find_by(user_id: recipient_id, event_id: event_id)
Class SlackMrkdwn
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SlackMrkdwn < Redcarpet::Render::Base
class << self
def from(markdown)
renderer = SlackMrkdwn.new
Redcarpet::Markdown.new(renderer, strikethrough: true, underline: true, fenced_code_blocks: true).render(markdown)
Method ransackable_attributes
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.ransackable_attributes(auth_object = nil)
[
"admin_memberships_count",
"admin_tags",
"admins_can_edit_user_content",
File scenarios_helper.rb
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Dev::ScenariosHelper
include Dev::FakeDataHelper
def poll_created_scenario(params)
group = create_group_with_members
Method initialize
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(user)
super(user)
can :vote_in, ::Poll do |poll|
user.is_logged_in? &&
StanceModel
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export default class StanceModel extends BaseModel {
static singular = 'stance';
static plural = 'stances';
static indices = ['pollId', 'latest', 'participantId'];
static uniqueIndices = ['id'];