Showing 1,155 of 1,155 total issues
Method make_export_series_statements_latest_list_pdf
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.make_export_series_statements_latest_list_pdf(items)
return false if items.blank?
report = EnjuTrunk.new_report('series_statements_latest_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"
Further reading
Method update
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def update
@user = current_user
respond_to do |format|
=begin
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
def index
@count = {}
# set screen option
@departments = Department.all
- 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 23 (exceeds 5 allowed). Consider refactoring. Open
def update
unless @user == current_user or current_user.has_role?('Librarian')
access_denied; return
end
unless @user.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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (nodeName == 'input' || nodeName == 'textarea') {
target.disabled = false;
control.siblings('button.' + this._triggerClass).
each(function() { this.disabled = false; }).end().
siblings('img.' + this._triggerClass).
- 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 100.
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
if (nodeName == 'input' || nodeName == 'textarea') {
target.disabled = true;
control.siblings('button.' + this._triggerClass).
each(function() { this.disabled = true; }).end().
siblings('img.' + this._triggerClass).
- 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 100.
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 showMenu
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.showMenu = function(){
killAllMenus();
if (!menu.menuExists) { menu.create() };
caller
.addClass('fg-menu-open')
Method get_list_size
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_list_size
return nil unless request.xhr?
# budgets
budgets = params[:budgets] || []
all_budgets = eval(params[:all_budgets]) if params[:all_budgets]
Class Agent
has 27 methods (exceeds 20 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 enju_hiduke2yyyymmdd_sub
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.enju_hiduke2yyyymmdd_sub(datestr)
yyyymmdd_from = nil
yyyymmdd_to = nil
dfrom = nil
dto = nil
Method show
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
@location_symbol_size = Keycode.where(:name => 'item.location_symbol')
if params[:isbn].present?
if @manifestation_redirect = Manifestation.find_by_isbn(params[:isbn])
File agents_controller.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
class AgentsController < ApplicationController
add_breadcrumb "I18n.t('page.listing', :model => I18n.t('activerecord.models.agent'))", 'agents_path'
add_breadcrumb "I18n.t('activerecord.models.agent')", 'agent_path(params[:id])', :only => [:show]
add_breadcrumb "I18n.t('page.new', :model => I18n.t('activerecord.models.agent'))", 'new_agent_path', :only => [:new, :create]
add_breadcrumb "I18n.t('page.editing', :model => I18n.t('activerecord.models.agent'))", 'edit_agent_path(params[:id])', :only => [:edit, :update]
Method create_pdf
has a Cognitive Complexity of 22 (exceeds 5 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]
- 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 output_userlist_pdf
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.output_userlist_pdf(users)
report = EnjuTrunk.new_report('userlist.tlf')
# set page_num
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"
Further reading
Method get_approval_report
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def get_approval_report
begin
@approval = Approval.find(params[:param])
case params[:output]
when 'report'
- 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_shelf
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def set_shelf(input_shelf, user, library, options = {:mode => 'input'})
if input_shelf.nil?
if options[:mode] == 'input'
if library.nil?
shelf = user.library.in_process_shelf
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
while address.length > max_column
address.length.times { |i|
cnt += 0.5 if address[i] =~ /^[\s0-9A-Za-z]+$/
cnt += 1 unless address[i] =~ /^[\s0-9A-Za-z]+$/
if cnt.to_f >= max_column or address[i+1].nil? or address[i] =~ /^[\n]+$/
- 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 110.
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
while name.length > max_column
name.length.times { |i|
cnt += 0.5 if name[i] =~ /^[\s0-9A-Za-z]+$/
cnt += 1 unless name[i] =~ /^[\s0-9A-Za-z]+$/
if cnt.to_f >= max_column or name[i+1].nil? or name[i] =~ /^[\n]+$/
- 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 110.
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 hiduke2yyyymmdd_sub
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.hiduke2yyyymmdd_sub(datestr)
yyyymmdd_from = nil
yyyymmdd_to = nil
dfrom = nil
dto = nil
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (cd.navtype < 0)
s.left = cd.offsetLeft + "px";
else {
var mcw = mc.offsetWidth;
if (typeof mcw == "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