Showing 345 of 709 total issues
Method index
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def index
if params[:mode] == 'add'
unless current_user.try(:has_role?, 'Librarian')
access_denied
return
- 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 27 (exceeds 5 allowed). Consider refactoring. Open
def index
unless current_user.has_role?('Librarian')
if @user
if current_user == @user
redirect_to reserves_url(format: params[:format])
- 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 import_record_from_loc
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.import_record_from_loc(doc)
record_identifier = doc.at('//mods:recordInfo/mods:recordIdentifier', NS).try(:content)
identifier_type = IdentifierType.find_by(name: 'loc_identifier')
identifier_type ||= IdentifierType.create!(name: 'loc_identifier')
loc_identifier = Identifier.find_by(body: record_identifier, identifier_type_id: identifier_type.id)
Method set_date_of_publication
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def set_date_of_publication
return if pub_date.blank?
year = Time.utc(pub_date.rjust(4, "0").to_i).year rescue nil
begin
- 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 import
has a Cognitive Complexity of 26 (exceeds 5 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)
- 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 _fetchEventSource
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _fetchEventSource(source, callback) {
var i;
var fetchers = FC.sourceFetchers;
var res;
Method modify
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def modify
transition_to!(:started)
rows = open_import_file(create_import_temp_file(attachment))
rows.shift
row_num = 1
- 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 destroy?
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def destroy?
if record.items.empty?
unless record.try(:is_reserved?)
if record.series_master?
if record.children.empty?
- 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 buildSegDragListener
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildSegDragListener: function(seg) {
var _this = this;
var view = this.view;
var calendar = view.calendar;
var el = seg.el;
Method index
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
unless current_user.has_role?('Librarian')
if @user
if current_user == @user
redirect_to reserves_url(format: params[:format])
Method update_item
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def update_item(item, row)
shelf = Shelf.find_by(name: row['shelf'].to_s.strip)
bookstore = Bookstore.find_by(name: row['bookstore'])
required_role = Role.find_by(name: row['item_required_role'])
- 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 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if params[:icalendar_token].present?
icalendar_user = Profile.where(checkout_icalendar_token: params[:icalendar_token]).first.try(:user)
if icalendar_user.blank?
raise ActiveRecord::RecordNotFound
Method make_query
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_query(query, options = {})
# TODO: integerやstringもqfに含める
query = query.to_s.strip
if query.size == 1
Method set_agent_value
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def set_agent_value(agent, row)
agent.first_name = row['first_name'] if row['first_name']
agent.middle_name = row['middle_name'] if row['middle_name']
agent.last_name = row['last_name'] if row['last_name']
agent.first_name_transcription = row['first_name_transcription'] if row['first_name_transcription']
- 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 destroy?
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def destroy?
return false unless user
return false unless user.try(:has_role?, 'Librarian')
if record.user
- 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 import
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
transition_to!(:started)
num = { user_imported: 0, user_found: 0, failed: 0, error: 0 }
rows = open_import_file(create_import_temp_file(attachment))
row_num = 1
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Method set_profile_params
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def set_profile_params(row)
params = {}
user_group = UserGroup.find_by(name: row['user_group']) || default_user_group
params[:user_group_id] = user_group.id if user_group
- 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 modify
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def modify
transition_to!(:started)
num = { user_updated: 0, user_not_found: 0, failed: 0 }
rows = open_import_file(create_import_temp_file(attachment))
row_num = 1
- 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 parse_pub_date
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def parse_pub_date(options)
pub_date = {}
if options[:pub_date_from].blank?
pub_date[:from] = "*"
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"