Showing 1,155 of 1,155 total issues
Method exec_print
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec_print
@barcode_list = BarcodeList.find(params[:id])
respond_to do |format|
if @barcode_list.usage_type == "user"
Method index
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
@count = {}
search = Sunspot.new_search(LibraryReport)
if params[:yyyymm]
@yyyymm = params[:yyyymm]
Method prepare_options
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_options
@libraries = Library.real
@libraries.delete_if {|l| l.shelves.empty?}
if @item.new_record?
@library = Library.real.first(:order => :position, :include => :shelves)
Method attr_extext_accessor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attr_extext_accessor(*args)
args.each do |arg|
class_eval <<-EOF
attr_accessible :#{arg}, :#{arg}_type_id
def #{arg}=(obj)
Method search
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search
@approvals = Approval.scoped
# approval_identifier
Similar blocks of code found in 2 locations. Consider refactoring. Open
record_count.times do
sum_details << {:jpn_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:foreign_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:jpn_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:foreign_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
- 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 66.
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
def update
@budget_category = BudgetCategory.find(params[:id])
if params[:move]
move_position(@budget_category, params[:move])
return
- 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 66.
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
record_count.times do
grand_totals << {:jpn_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:foreign_not_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:jpn_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
:foreign_donate => {:book => 0, :price => 0, :book_remove => 0, :price_remove => 0},
- 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 66.
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
def update
@department = Department.find(params[:id])
if params[:move]
move_position(@department, params[:move])
return
- 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 66.
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
Function keyHandler
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function keyHandler( handleObj ) {
// Only care when a possible input has been specified
if ( typeof handleObj.data !== "string" ) {
return;
}
Method output_reminder_list_tsv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.output_reminder_list_tsv(reminder_lists)
columns = [
[:checkout_id, 'activerecord.attributes.reminder_list.checkout_id'],
[:title, 'activerecord.attributes.reminder_list.original_title'],
[:call_number, 'activerecord.attributes.item.call_number'],
Method do_order
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_order(letter_file_only = false)
# generate order file
order_file_dir = File.join(Rails.root.to_s, 'private', 'system', 'order_letter', "#{self.id}")
order_file_path = File.join(order_file_dir, "order_letter_#{Time.now.strftime("%Y%m%d")}")
FileUtils.mkdir_p(order_file_dir)
Method make_export_new_book_list_tsv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_export_new_book_list_tsv(items)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
# set term
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if @bookbinding
@binding_item = BindingItem.new(params[:binding_item])
@binding_item.bookbinding = @bookbinding
else
Method create
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@agent = Agent.new(params[:agent])
if @agent.user_username
@agent.user = User.find(@agent.user_username) rescue nil
Method update
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
if params[:item][:claim_attributes]
if params[:item][:claim_attributes][:claim_type_id].blank? && params[:item][:claim_attributes][:note].blank?
params[:item][:claim_attributes][:_destroy] = 1
end
Method cleanup!
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def cleanup!
now = Time.now
Dir.glob(path_format%['*', '*', '*', '*']) do |path|
next unless File.file?(path)
- 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 generate_order_list
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_order_list(start_at, end_at)
# generate order list
logger.debug "self.generate_order_list start_at=#{start_at} end_at=#{end_at}"
order_lists = OrderList.where(:ordered_at => start_at.beginning_of_day..end_at.end_of_day)
- 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 user_notice
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def user_notice
@messages = []
@messages << I18n.t('user.not_connect', :user => self.username) if self.unable
overdues = self.checkouts.overdue(Time.zone.today.beginning_of_day) rescue nil
@messages << I18n.t('user.overdue_item', :user => self.username, :count => overdues.length) unless overdues.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
Method get_family_info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_family_info
return nil unless request.xhr?
unless params[:user_id].blank?
family_id = FamilyUser.where(:user_id => params[:user_id]).first.family_id rescue nil
@user = User.find(FamilyUser.where(:family_id => family_id).order(:id).first.user_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"