Showing 1,155 of 1,155 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
else {
var ycw = yc.offsetWidth;
if (typeof ycw == "undefined")
- 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 96.
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
switch (valign) {
case "T": p.y -= h; break;
case "B": p.y += el.offsetHeight; break;
case "C": p.y += (el.offsetHeight - h) / 2; break;
case "t": p.y += el.offsetHeight - h; break;
- 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 96.
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
switch (halign) {
case "L": p.x -= w; break;
case "R": p.x += el.offsetWidth; break;
case "C": p.x += (el.offsetWidth - w) / 2; break;
case "l": p.x += el.offsetWidth - w; break;
- 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 96.
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 tableMouseOver
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
Calendar.tableMouseOver = function (ev) {
var cal = Calendar._C;
if (!cal) {
return;
}
Method search_family
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search_family
return nil unless request.xhr?
unless params[:keys].blank?
tel_1 = params[:keys][:tel_1]
tel_1.delete!("-")
Method set_manifestations_data
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.set_manifestations_data(column, manifestation_ids)
logger.debug "begin export manifestations"
transaction do
where(:id => manifestation_ids).
includes(
Function Keypad
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Keypad() {
this._curInst = null; // The current instance in use
this._disabledFields = []; // List of keypad fields that have been disabled
this._keypadShowing = false; // True if the popup panel is showing , false if not
this._keyCode = 0;
Method make_query_filter
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_query_filter(options)
with = []
without = []
#
Method identify_manifestation
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def identify_manifestation(datas, sheet)
Rails.logger.debug "identify_manifestation"
scope = Manifestation.scoped
scope = scope.readonly(false)
Method fetch
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def fetch(row, options = {:edit_mode => 'create'})
shelf = Shelf.where(:name => row['shelf'].to_s.strip).first || Shelf.web
case options[:edit_mode]
when 'create'
manifestation = 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"
Further reading
Method set_column
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def self.set_column(selected_column, manifestation_ids)
col_spec = OUTPUT_COLUMN_FIELDS.inject({}) do |spec, name|
spec[name] = select_output_column_spec(name)
spec
end
- 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 create_pdf_sheet
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def create_pdf_sheet(start_number,end_number)
dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
#filename = "barcode#{Time.now.strftime('%s')}.pdf"
filename = "barcode.pdf"
- 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 set_user_value
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def set_user_value(user, row)
#日本語化
username = I18n.t('activerecord.attributes.user.username')
user_number = I18n.t('activerecord.attributes.user.user_number')
library = I18n.t('activerecord.attributes.user.library')
- 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 create_pdf_sheet_custom
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def create_pdf_sheet_custom(custom_barcodes)
dir_base = "#{Rails.root}/private/system/barcode_list/#{self.id}/original/"
FileUtils.mkdir_p(dir_base) unless FileTest.exist?(dir_base)
#filename = "barcode#{Time.now.strftime('%s')}.pdf"
filename = "barcode.pdf"
- 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 exec_print
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def exec_print
@barcode_list = BarcodeList.find(params[:id])
respond_to do |format|
if @barcode_list.usage_type == "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 field_index_set
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def field_index_set(field_keys)
names = {}
field_keys.each do |fk|
next unless @column_spec[fk] == :plural
name = field_name(fk)
- 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 edit
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def edit
@series_statement.work = @work if @work
@creators = @series_statement.root_manifestation.try(:creates).present? ? @series_statement.root_manifestation.creates.order(:position) : [{}] unless @creators
@contributors = @series_statement.root_manifestation.try(:realizes).present? ? @series_statement.root_manifestation.realizes.order(:position) : [{}] unless @contributors
@publishers = @series_statement.root_manifestation.try(:produces).present? ? @series_statement.root_manifestation.produces.order(:position) : [{}] unless @publishers
- 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 showAtElement
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Calendar.prototype.showAtElement = function (el, opts) {
var self = this;
var p = Calendar.getAbsolutePos(el);
if (!opts || typeof opts != "string") {
this.showAt(p.x, p.y + el.offsetHeight);
Method output_excelx
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.output_excelx(output_data, filename = nil)
require 'axlsx'
# initialize
if filename.present?
Method make_export_removed_list_pdf
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.make_export_removed_list_pdf(items)
return false if items.blank?
report = EnjuTrunk.new_book_term('removed_list')
report.events.on :page_create do |e|
- 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"