Showing 1,155 of 1,155 total issues
Method add_exinfos
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.add_exinfos(exinfos, item_id)
return [] if exinfos.blank?
list = []
exinfos.each do |key, value|
name = key.split('_').first
Method add_exinfos
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.add_exinfos(exinfos, manifestation_id)
return [] if exinfos.blank?
list = []
exinfos.each do |key, value|
name = key.split('_').first
Method new
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def new
if user_signed_in?
unless current_user.has_role?('Librarian')
access_denied; return
end
Similar blocks of code found in 2 locations. Consider refactoring. Open
Calendar.findMonth = function(el) {
if (typeof el.month != "undefined") {
return el;
} else if (typeof el.parentNode.month != "undefined") {
return el.parentNode;
- 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 69.
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
Calendar.findYear = function(el) {
if (typeof el.year != "undefined") {
return el;
} else if (typeof el.parentNode.year != "undefined") {
return el.parentNode;
- 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 69.
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
ResourceImportTextresult.generate_resource_import_textresult_list_internal(textresults, output_type) do |output|
io, info = user_file.create(:resource_import_results, output.filename)
if output.result_type == :path
open(output.path) { |io2| FileUtils.copy_stream(io2, io) }
else
- 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 68.
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
Checkoutlist.generate_checkoutlist(output_type, circulation_status_ids) do |output|
io, info = user_file.create(:checkoutlist, output.filename)
if output.result_type == :path
open(output.path) {|io2| FileUtils.copy_stream(io2, io) }
else
- 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 68.
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 showYearsCombo
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Calendar.showYearsCombo = function (fwd) {
var cal = Calendar._C;
if (!cal) {
return false;
}
Method make_export_removed_list_tsv
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_export_removed_list_tsv(items)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
columns = [
Method build_new_record
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_new_record
if action_name == 'new'
form_input = params
else
form_input = params[:nacsis_user_request]
Method bestrequest
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def bestrequest
logger.info "bestrequest start"
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
Method update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@user = current_user
respond_to do |format|
=begin
Method get_list_size
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_list_size
if !request.xhr? || params[:list_type].blank?
render :nothing => true, :status => :not_found
return
Method build_associated_records
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_associated_records(sheet, datas, record, assoc_name, spec)
field_keys = spec.values.map(&:first)
target_data = sheet.field_data_set(datas, field_keys)
return nil if target_data.nil?
Function create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.create = function(){
container.css({ width: options.width }).appendTo('body').find('ul:first').not('.fg-menu-breadcrumb').addClass('fg-menu');
container.find('ul, li a').addClass('ui-corner-all');
// aria roles & attributes
Method make_item_register_pdf
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_item_register_pdf(pdf_file, items, list_title = nil)
report = EnjuTrunk.new_report('item_register.tlf')
report.events.on :page_create do |e|
e.page.item(:page).value(e.page.no)
end
Method make_export_new_item_list_tsv
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_export_new_item_list_tsv(items)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
# set term
Method create_pdf
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_pdf
@barcode_list = BarcodeList.find(params[:barcode_list_id])
start_number = params[:barcode_list][:start_number]
end_number = params[:barcode_list][:end_number]
Method open_import_file
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def open_import_file
tempfile = Tempfile.new('agent_import_file')
if Setting.uploaded_file.storage == :s3
uploaded_file_path = open(self.agent_import.expiring_url(10)).path
else
Method make_form
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_form(system_configuration, errors = nil)
#TODO:
error = nil
if errors
errors.each do |e|