Showing 709 of 709 total issues
Method import
has a Cognitive Complexity of 44 (exceeds 5 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
- 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 manifestations_helper.rb
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ManifestationsHelper
# include EnjuCirculation::ManifestationsHelper if defined?(EnjuCirculation)
def resource_title(manifestation, action)
string = LibraryGroup.site_config.display_name.localize.dup
Method import_record_from_loc
has a Cognitive Complexity of 41 (exceeds 5 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)
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
getVerticalIndex: function(topOffset) {
this.ensureBuilt();
var boundingRect = this.boundingRect;
var tops = this.tops;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 157.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
getHorizontalIndex: function(leftOffset) {
this.ensureBuilt();
var boundingRect = this.boundingRect;
var lefts = this.lefts;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 157.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method modify
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def modify
transition_to!(:started)
rows = open_import_file
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 index
has a Cognitive Complexity of 36 (exceeds 5 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
- 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 renderSection
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
function renderSection(position) {
var sectionEl = $('<div class="fc-' + position + '"/>');
var options = calendar.options;
var buttonStr = options.header[position];
Method get_mods_carrier_and_content_types
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_mods_carrier_and_content_types(doc)
carrier_type = content_type = nil
doc.xpath('//mods:form', NS).each do |e|
authority = e.attributes['authority'].try(:content)
case authority
Similar blocks of code found in 2 locations. Consider refactoring. Open
buildElHorizontals: function() {
var lefts = [];
var rights = [];
this.els.each(function(i, node) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
buildElVerticals: function() {
var tops = [];
var bottoms = [];
this.els.each(function(i, node) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 141.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method update_carrier_type
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def update_carrier_type
CarrierType.find_each do |carrier_type|
case carrier_type.name
when "volume"
carrier_type = CarrierType.find_by(name: 'volume')
- 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 migrate_attachment_s3
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
def migrate_attachment_s3
AgentImportFile.where.not(agent_import_file_name: nil).find_each do |file|
file.attachment.attach(
io: URI(Paperclip::Attachment.new(
:agent_import,
Method migrate_attachment
has 124 lines of code (exceeds 25 allowed). Consider refactoring. Open
def migrate_attachment
option = {
path: ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
}
Method set_acquisition_date
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def set_acquisition_date(query, options)
unless options[:acquired_from].blank? && options[:acquired_until].blank?
options[:acquired_from].to_s.gsub!(/\D/, '')
options[:acquired_until].to_s.gsub!(/\D/, '')
- 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
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_record(doc)
iss_itemno = URI.parse(doc.at('//dcndl:BibAdminResource[@rdf:about]').values.first).path.split('/').last
ndl_bib_id_record =NdlBibIdRecord.find_by(body: iss_itemno)
return ndl_bib_id_record.manifestation if ndl_bib_id_record
Method make_internal_query
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def make_internal_query(search)
# 内部的なクエリ
set_role_query(current_user, search)
unless params[:mode] == "add"
- 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 Manifestation
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Manifestation < ApplicationRecord
include EnjuCirculation::EnjuManifestation
include EnjuSubject::EnjuManifestation
include EnjuNdl::EnjuManifestation
include EnjuNii::EnjuManifestation
File enju_manifestation.rb
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
module EnjuNdl
module EnjuManifestation
extend ActiveSupport::Concern
module ClassMethods
Method index
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
query = params[:query].to_s.strip
per_page = Item.default_per_page
@count = {}
if user_signed_in?