Showing 5,431 of 5,433 total issues
Complex method BatchesController#show (36.0) Open
def show # rubocop:todo Metrics/AbcSize
respond_to do |format|
format.html do
@submenu_presenter = Presenters::BatchSubmenuPresenter.new(current_user, @batch)
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Plate::Creator#create_plates_from_tube_racks! (35.8) Open
def create_plates_from_tube_racks!(
tube_racks,
barcode_printer,
scanned_user,
should_create_asset_group,
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Ability::Manager#grant_privileges (35.5) Open
def grant_privileges # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
Rails.logger.debug { 'Granting Manager privileges' }
can(:edit, Labware) { |lw| !lw.is_a?(PlateTemplate) }
cannot :edit, PlateTemplate
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Admin::UsersController#update (35.4) Open
def update # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
@user = User.find(params[:id])
Role.general_roles.each do |role|
params[:role] && params[:role][role.name] ? @user.grant_role(role.name) : @user.remove_role(role.name)
end
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method QcReportsController#index (35.3) Open
def index # rubocop:todo Metrics/AbcSize
# Build a conditions hash of acceptable parameters, ignoring those that are blank
@qc_reports = QcReport.for_report_page(conditions).page(params[:page]).includes(:study, :product)
@qc_report = QcReport.new(exclude_existing: true, study_id: params[:study_id])
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method ReceptaclesController#update (35.3) Open
def update # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
respond_to do |format|
if @asset.update(asset_params.merge(params.to_unsafe_h.fetch(:lane, {})))
flash[:notice] = 'Receptacle was successfully updated.'
if params[:lab_view]
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Batch#generate_target_assets_for_requests (35.1) Open
def generate_target_assets_for_requests # rubocop:todo Metrics/AbcSize
requests_to_update = []
asset_type = pipeline.asset_type.constantize
requests.reload.each do |request|
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method serialize
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.serialize(st) # rubocop:todo Metrics/CyclomaticComplexity
attributes = st.attributes
new_attributes = {}
STRAIGHT_CLONE.each do |key|
- 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 _check_mandatory_field
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_mandatory_field(mandatory_field) # rubocop:todo Metrics/CyclomaticComplexity, Metrics/AbcSize
return unless upload.respond_to?(:rows)
upload.rows.each do |row|
next if row.columns.blank? || row.data.blank?
col_num = row.columns.find_column_or_null(:name, mandatory_field).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 duplicate_barcodes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def duplicate_barcodes # rubocop:todo Metrics/CyclomaticComplexity
return unless upload.respond_to?(:rows)
unique_bcs = []
upload.rows.each do |row|
- 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 non_matching_retention_instructions_for_plates
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def non_matching_retention_instructions_for_plates
return nil, nil unless upload.respond_to?(:rows)
# Initialize empty retention_instructions hash to store retention instructions
upload
- 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 non_matching_retention_instructions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def non_matching_retention_instructions
return nil, nil unless upload.respond_to?(:rows)
upload
.rows
- 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
Complex method Asset::Finder#find_wells_in_array (35.0) Open
def find_wells_in_array(plate, well_array) # rubocop:todo Metrics/CyclomaticComplexity
return plate.wells.in_column_major_order.with_aliquots.distinct if well_array.empty?
well_array.flat_map do |map_description|
case map_description
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method SequencingQcBatch::adjacent_state_helper (34.8) Open
def self.adjacent_state_helper(direction, offset, delimiter) # rubocop:todo Metrics/AbcSize
define_method(:"qc_#{direction}_state") do
unless qc_states.include?(qc_state.to_s)
raise StandardError, "Current QC state appears to be invalid: '#{qc_state}'"
end
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Method swap
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def swap(current_user, batch_info = {}) # rubocop:todo Metrics/CyclomaticComplexity
return false if batch_info.empty?
# Find the two lanes that are to be swapped
batch_request_left =
Complex method SampleManifestExcel::Upload::Processor::Plate#duplicate_barcodes (34.7) Open
def duplicate_barcodes # rubocop:todo Metrics/CyclomaticComplexity
return nil, nil unless upload.respond_to?(:rows)
unique_bcs = {}
unique_plates = {}
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Identical blocks of code found in 2 locations. Consider refactoring. Open
expect(state.plates).toEqual({
1: {
id: 1,
barcode: "DN12345",
batches: ["1", "2", "3"],
- 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 66.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
expect(state.plates).toEqual({
1: { id: 1, barcode: "DN12345", batches: ["1", "2", "3"], picks: { 1: ["Pick"], 2: ["Other", "New"] } },
});
- 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 66.
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
def non_matching_retention_instructions
return nil, nil unless upload.respond_to?(:rows)
upload
.rows
- 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 2 locations. Consider refactoring. Open
def non_matching_retention_instructions_for_plates
return nil, nil unless upload.respond_to?(:rows)
# Initialize empty retention_instructions hash to store retention instructions
upload
- 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