Showing 345 of 709 total issues
Function buildSegResizeListener
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildSegResizeListener: function(seg, isStart) {
var _this = this;
var view = this.view;
var calendar = view.calendar;
var el = seg.el;
Function buildDayDragListener
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildDayDragListener: function() {
var _this = this;
var view = this.view;
var isSelectable = view.opt('selectable');
var dayClickHit; // null if invalid dayClick
File reserves_controller.rb
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ReservesController < ApplicationController
before_action :set_reserve, only: [:show, :edit, :update, :destroy]
before_action :check_policy, only: [:index, :new, :create]
before_action :prepare_options, only: [:new, :edit]
before_action :get_user, only: [:index, :new]
File items_controller.rb
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ItemsController < ApplicationController
include EnjuInventory::Controller
before_action :set_item, only: [:show, :edit, :update, :destroy]
before_action :check_policy, only: [:index, :new, :create]
before_action :get_agent, :get_manifestation, :get_shelf, except: [:create, :update, :destroy]
Function makeMoment
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
function makeMoment(args, parseAsUTC, parseZone) {
var input = args[0];
var isSingleString = args.length == 1 && typeof input === 'string';
var isAmbigTime;
var isAmbigZone;
Method create_loc_subject_related_elements
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.create_loc_subject_related_elements(doc, manifestation)
subjects = get_mods_subjects(doc)
classifications = get_mods_classifications(doc)
if defined?(EnjuSubject)
subject_heading_type = SubjectHeadingType.find_by(name: 'lcsh') || SubjectHeadingType.create!(name: 'lcsh')
- 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 index
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def index
if params[:mode] == 'select'
if @library
@shelves = @library.shelves
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
Function fgSegHtml
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
fgSegHtml: function(seg, disableResizing) {
var view = this.view;
var event = seg.event;
var isDraggable = view.isEventDraggable(event);
var isResizableFromStart = !disableResizing && seg.isStart && view.isEventResizableFromStart(event);
File user_import_file.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
class UserImportFile < ApplicationRecord
include Statesman::Adapters::ActiveRecordQueries[
transition_class: UserImportFileTransition,
initial_state: UserImportFileStateMachine.initial_state
]
Class ResourceImportFile
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ResourceImportFile < ApplicationRecord
include Statesman::Adapters::ActiveRecordQueries[
transition_class: ResourceImportFileTransition,
initial_state: ResourceImportFileStateMachine.initial_state
]
File attachment.rb
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
def migrate_attachment
option = {
path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
}
Method deletable_by?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def deletable_by?(current_user)
return nil unless current_user
if defined?(EnjuCirculation)
# 未返却の資料のあるユーザを削除しようとした
- 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 update
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def update
respond_to do |format|
if @series_statement_merge_list.update(series_statement_merge_list_params)
if params[:mode] == 'merge'
selected_series_statement = SeriesStatement.find(params[:selected_series_statement_id]) rescue 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 index
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def index
@count = {}
query = params[:query].to_s.strip
@query = query.dup
query = query.gsub(' ', ' ')
- 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 index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@count = {}
if request.format.text?
per_page = 65534
else
Method modify
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def modify
transition_to!(:started)
rows = open_import_file(create_import_temp_file(attachment))
rows.shift
row_num = 1
Method create_additional_attributes
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_additional_attributes(doc, manifestation)
title = get_title(doc)
creators = get_creators(doc).uniq
subjects = get_subjects(doc).uniq
classifications = get_classifications(doc).uniq
Function buildViewSpec
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildViewSpec: function(requestedViewType) {
var viewOverrides = this.overrides.views || {};
var specChain = []; // for the view. lowest to highest priority
var defaultsChain = []; // for the view. lowest to highest priority
var overridesChain = []; // for the view. lowest to highest priority
Function fgSegHtml
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
fgSegHtml: function(seg, disableResizing) {
var view = this.view;
var event = seg.event;
var isDraggable = view.isEventDraggable(event);
var isResizableFromStart = !disableResizing && event.allDay &&
Method import
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
transition_to!(:started)
num = { imported: 0, failed: 0 }
rows = open_import_file(create_import_temp_file(attachment))
check_field(rows.first)