Showing 1,155 of 1,155 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
grand_totals.each do |grand_total|
books_row << grand_total[:jpn_not_donate][book_sym]
books_row << grand_total[:jpn_not_donate][price_sym] if conditions.money_aggregation.present?
books_row << grand_total[:foreign_not_donate][book_sym]
books_row << grand_total[:foreign_not_donate][price_sym] if conditions.money_aggregation.present?
- 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 79.
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 search_by_gateway
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_by_gateway(options)
# db_type = db_names = nil
key_to_db = {
all: '_ALL_',
Method index
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
unless can_use_purchase_request?
access_denied; return
else
if !user_signed_in?
Method bulk_update
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bulk_update
unless (user_signed_in? and current_user.has_role?('Librarian'))
access_denied; return
end
unless @basket
Consider simplifying this complex logical expression. Open
if items.nil? || items.size < 1
logger.warn "item data is empty"
else
items.each do |item|
row = []
Method export_tsv
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.export_tsv(expenses)
dir_base = "#{Rails.root}/private/system"
out_dir = "#{dir_base}/expense/"
tsv_file = out_dir + "expenses.tsv"
FileUtils.mkdir_p(out_dir) unless FileTest.exist?(out_dir)
Method generate_order_list
has 50 lines of code (exceeds 25 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)
Method update_all
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_all
changed = failed = 0
abilities = {}
(params['function_class_abilities'] || {}).each do |function_id, ability|
Method make_form_selector
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_form_selector(string, system_configuration)
string << "<select name=system_configurations[#{ system_configuration.id }]>"
case system_configuration.keyname
when 'header.disp_date'
3.times do |i|
Function move
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function move(target, event, animate) {
var input = target.parents('.minicolors').find('.minicolors-input'),
settings = input.data('minicolors-settings'),
picker = target.find('[class$=-picker]'),
Method do_numbering
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.do_numbering(name, is_save = true, options = {})
counter = 10
n = nil
number = ''
Numbering.transaction do
Method new
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
@select_theme_tags = Manifestation.struct_theme_selects if defined?(EnjuTrunkTheme)
original_manifestation = Manifestation.where(:id => params[:manifestation_id]).first
if original_manifestation # GET /manifestations/new?manifestation_id=1
@manifestation = original_manifestation.dup
Method get_approval_report
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_approval_report
begin
@approval = Approval.find(params[:param])
case params[:output]
when 'report'
Identical blocks of code found in 2 locations. Consider refactoring. Open
else if (menuType == 'ipod') {
$(event.target).trigger('click');
setTimeout(function(){
$(event.target).next().find('a:eq(0)').trigger('mouseover');
}, options.crossSpeed);
- 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 74.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ($(event.target).is('.fg-menu-indicator') && menuType == 'ipod') {
$(event.target).trigger('click');
setTimeout(function(){
$(event.target).next().find('a:eq(0)').trigger('mouseover');
}, options.crossSpeed);
- 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 74.
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 generate_manifestation_list_internal
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.generate_manifestation_list_internal(manifestation_ids, output_type, current_user, summary, cols, &block)
output = OpenStruct.new
output.result_type = output_type == :excelx ? :path : :data
case output_type
when :pdf
Function hideShowCovered
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Calendar.prototype.hideShowCovered = function () {
if (!Calendar.is_ie && !Calendar.is_opera)
return;
function getVisib(obj){
var value = obj.style.visibility;
Method hold_query
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hold_query(command, db_type)
return unless @item
return @item.nacsis_identifier if command == 'delete'
query_field = command == 'update' ? ["ID=#{@item.nacsis_identifier}"] : []
Method bestreader
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bestreader
if params[:opac] and params[:search_date_first].blank? and params[:search_date_last].blank?
@start_d = (Date.today - 2.weeks).to_s
@end_d = Date.today.to_s
end
Method create
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
list_type = params[:export_item_register][:list_type]
file_type = params[:export_item_register][:file_type]
unless %w(pdf tsv).include?(file_type)
flash[:message] = t('item_register.invalid_file_type')