Showing 1,155 of 1,155 total issues
Method adhoc_text_field_query
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def adhoc_text_field_query(qwords, model, fields, nest = true, op = :default)
model_string_fields = {}
Sunspot::Setup.for(model).fields.each do |sunspot_field|
next unless sunspot_field.type.is_a?(Sunspot::Type::StringType)
model_string_fields[sunspot_field.name] = sunspot_field.indexed_name
- 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_user_info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def get_user_info
return nil unless request.xhr?
unless params[:user_number].blank?
@user = User.get_user(params[:user_number])
if @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 set_exclude_agents
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def set_exclude_agents(old_exclude_agents, new_exclude_agents)
old_exclude_agents.each do |p|
next if new_exclude_agents.include?(p)
agent = Agent.where(:full_name => p).first
if agent
- 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 monthly_report
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def monthly_report
yyyymm = params[:library_report][:yyyymm]
library_ids = params[:library]
begin
report = EnjuTrunk.new_report('monthly_library_report.tlf')
- 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 select_output_column_spec
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def select_output_column_spec(field, spec_hash = OUTPUT_COLUMN_SPEC)
separation = separate_output_columns?
if field == :all
regexp = nil
else
- 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 initialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def initialize(params)
raise QueryArgumentError, 'sru :query is required item.' unless params.has_key?(:query)
@cql = Cql.new(params[:query])
@version = params.has_key?(:version) ? params[:version] : '1.2'
- 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 tab_menu_width
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def tab_menu_width
# ライブラリアン権限時未満のとき、タブメニューの表示内容に伴いタブのサイズも変更する
if user_signed_in?
unless current_user.has_role?('Librarian')
# ゲスト権限以上ユーザ権限未満でログイン時
- 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 make_export_series_statements_latest_list_tsv
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.make_export_series_statements_latest_list_tsv(items)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
columns = [
Method get_list_size
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_list_size
unless request.xhr? && params[:list_type].present?
render :nothing => true, :status => :not_found
return
end
Method show
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
unless @agent.user.blank?
access_denied; return
end
Similar blocks of code found in 4 locations. Consider refactoring. Open
def update
if @item and params[:position]
@own.insert_at(params[:position])
redirect_to item_owns_url(@item)
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 64.
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 4 locations. Consider refactoring. Open
def update
# 並べ替え
if @expression and params[:position]
@realize.insert_at(params[:position])
redirect_to expression_realizes_url(@expression)
- 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 64.
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 4 locations. Consider refactoring. Open
def update
# 並べ替え
if @work and params[:position]
@create.insert_at(params[:position])
redirect_to work_creates_url(@work)
- 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 64.
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 4 locations. Consider refactoring. Open
def update
if @manifestation and params[:position]
@produce.insert_at(params[:position])
redirect_to manifestation_produces_url(@manifestation)
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 64.
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 get_manifestation_list_pdf
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_manifestation_list_pdf(manifestation_ids, current_user, summary = nil, type = :book)
report = EnjuTrunk.new_report('searchlist.tlf')
# set page_num
report.events.on :page_create do |e|
Function upload
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.upload = function(url, data, callback, type) {
var self = this, inputs, checkbox, checked,
iframeName = 'jquery_upload' + ++uuid,
iframe = $('<iframe name="' + iframeName + '" style="position:absolute;top:-9999px" />').appendTo('body'),
form = '<form target="' + iframeName + '" method="post" enctype="multipart/form-data" />';
Method get_unable_list_tsv
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_unable_list_tsv(users)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
columns = [
# [:library, 'activerecord.attributes.user.library'],
Method get_agent_import_results_tsv
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_agent_import_results_tsv(agent_import_results)
data = String.new
data << "\xEF\xBB\xBF".force_encoding("UTF-8") + "\n"
columns = [
[:agent, 'activerecord.models.agent'],
Method delete_record
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_record(error_msgs, item, manifestation, series_statement)
deleted_item =
deleted_item_identifier =
deleted_manifestation =
deleted_manifestation_title =
Method update_manifestation_agents
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_manifestation_agents(sheet, datas, field, manifestation, error_msgs)
create_new = SystemConfiguration.get("add_only_exist_agent") == true
[
["#{field}.creator", :creates=, :creates],