Showing 1,155 of 1,155 total issues
Method enju_hiduke2yyyymmdd_sub
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def self.enju_hiduke2yyyymmdd_sub(datestr)
yyyymmdd_from = nil
yyyymmdd_to = nil
dfrom = nil
dto = 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_agent_value
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_agent_value(agent, row)
#日本語化
full_name = I18n.t('activerecord.attributes.agent.full_name')
full_name_transcription = I18n.t('activerecord.attributes.agent.full_name_transcription')
full_name_alternative = I18n.t('activerecord.attributes.agent.full_name_alternative')
Method create_manifestation_from_nacsis_cat
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def create_manifestation_from_nacsis_cat(nacsis_cat, book_types, manifestation = nil)
return nil if nacsis_cat.blank?
ActiveRecord::Base.transaction do
child_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 process_book_data
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def process_book_data(import_textresult, datas, sheet, textfile, numbering, auto_numbering, not_set_serial_number, external_resource)
manifestation = series_statement = item = nil
error_msgs = []
# 所蔵、シリーズ、書誌を特定する
- 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 find_same_item
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def find_same_item(attrs, manifestation_type)
conditions = ["((manifestations).manifestation_type_id = \'#{manifestation_type.id}\')"] # FIXME!
attrs.each do |key, value|
case key
when 'creators', 'subjects'
- 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 download_file
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download_file
@libraries = Library.all
@bookstores = Bookstore.all
@budgets = Budget.all
@budget_types = BudgetType.all
File agent.rb
has 342 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Agent < ActiveRecord::Base
attr_accessible :last_name, :middle_name, :first_name,
:last_name_transcription, :middle_name_transcription,
:first_name_transcription, :corporate_name, :corporate_name_transcription,
:full_name, :full_name_transcription, :full_name_alternative, :zip_code_1,
Method index
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
#session[:params] = {} unless session[:params]
#session[:params][:agent] = params
# 最近追加されたパトロン
#@query = params[:query] ||= "[* TO *]"
Function _init
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
Calendar.prototype._init = function (firstDayOfWeek, date) {
var today = new Date(),
TY = today.getFullYear(),
TM = today.getMonth(),
TD = today.getDate();
Method fetch
has 103 lines of code (exceeds 25 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
Method index
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def index
unless SystemConfiguration.get("user_show_questions")
unless current_user.has_role?('Librarian')
access_denied; return
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 import
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import
sm_start!
#日本語化
full_name = I18n.t('activerecord.attributes.agent.full_name')
username = I18n.t('activerecord.attributes.user.username')
Function updateFromControl
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateFromControl(input, target) {
function getCoords(picker, container) {
var left, top;
Method construct_list_query
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def construct_list_query(list_type, library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, apply_order)
scope = Item.scoped
ti = Item.arel_table
tc = Checkout.arel_table
Similar blocks of code found in 2 locations. Consider refactoring. Open
$.fn.getTotalHeight = function(){
return $(this).height() + parseInt($(this).css('paddingTop')) + parseInt($(this).css('paddingBottom')) + parseInt($(this).css('borderTopWidth')) + parseInt($(this).css('borderBottomWidth'));
};
- 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 114.
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
$.fn.getTotalWidth = function(){
return $(this).width() + parseInt($(this).css('paddingRight')) + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('borderRightWidth')) + parseInt($(this).css('borderLeftWidth'));
};
- 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 114.
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 export_pdf
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def self.export_pdf(expenses)
begin
report = EnjuTrunk.new_report('expense_list.tlf')
report.events.on :page_create do |e|
e.page.item(:page).value(e.page.no)
- 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 bestrequest
has a Cognitive Complexity of 27 (exceeds 5 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
- 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 27 (exceeds 5 allowed). Consider refactoring. Open
def index
query = params[:query].to_s.strip
per_page = Item.default_per_page
@count = {}
if user_signed_in?
- 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 update
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def update
@relationship_family = @series_statement_relationship.relationship_family
before_relationship_series_statement_ids = @series_statement_relationship.relationship_family.series_statements.map(&:id)
SeriesStatementRelationship.transaction do
@series_statement_relationship.update_attributes!(params[:series_statement_relationship])
- 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"