Showing 5,424 of 5,426 total issues
Class StudiesController
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class StudiesController < ApplicationController
# WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behviour.
# It should be removed wherever possible and the correct Strong Parameter options applied in its place.
before_action :evil_parameter_hack!
include REXML
Class TestWorksheet
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class TestWorksheet < SequencescapeExcel::Worksheet::Base # rubocop:todo Metrics/ClassLength
include SequencescapeExcel::Helpers::Worksheet
self.worksheet_name = 'DNA Collections Form'
Class Row
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Row # rubocop:todo Metrics/ClassLength
include ActiveModel::Model
include Converters
attr_accessor :number, :data, :columns, :cache
Complex method SampleManifestExcel::Worksheet::TestWorksheet#record_plate_samples (61.6) Open
def record_plate_samples # rubocop:todo Metrics/AbcSize
sm_sample_assets = sample_manifest.sample_manifest_assets.to_a
first_to_last.each_with_index do |sheet_row, sample_index|
cur_sm_sample_asset = sm_sample_assets.fetch(sample_index)
- 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
File bulk_submission.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
module ArrayWithFieldList
refine Array do
def comma_separate_field_list_for_display(*fields)
field_list(*fields).join(', ')
end
File batches_controller.rb
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
class BatchesController < ApplicationController # rubocop:todo Metrics/ClassLength
# WARNING! This filter bypasses security mechanisms in rails 4 and mimics rails 2 behaviour.
# It should be removed wherever possible and the correct Strong Parameter options applied in its place.
before_action :evil_parameter_hack!
Method prepare_order
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def prepare_order(details) # rubocop:todo Metrics/CyclomaticComplexity
# Retrieve common attributes
study = Study.find_by_id_or_name!(details['study id'], details['study name'])
project = Project.find_by_id_or_name!(details['project id'], details['project name'])
user = User.find_by(login: details['user login']) or
- 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 namespace(sequencing)::namespace(novaseq)::task#setup (60.5) Open
task setup: :environment do
# rubocop:todo Metrics/BlockLength
ActiveRecord::Base.transaction do
unless RequestType.exists?(key: 'illumina_htp_novaseq_6000_paired_end_sequencing')
RequestType
- 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 namespace(pac_bio_run)::task#rebroadcast_duplicates (60.5) Open
task rebroadcast_duplicates: :environment do
# This task resends messages
list_of_runs = [
10_056,
- 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
Similar blocks of code found in 3 locations. Consider refactoring. Open
$("#asset_scan").bind("keydown", function (e) {
/* We don't take tab index into account here */
var ENTER = 13,
TAB = 9,
code;
- 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 109.
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 3 locations. Consider refactoring. Open
$("#asset_scan").bind("keydown", function (e) {
/* We don't take tab index into account here */
var ENTER = 13,
TAB = 9,
code;
- 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 109.
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 3 locations. Consider refactoring. Open
$("#asset_scan").bind("keydown", function (e) {
/* We don't take tab index into account here */
var ENTER = 13,
TAB = 9,
code;
- 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 109.
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
File plate.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'lab_where_client'
# https://github.com/sanger/sequencescape/raw/master/docs/images/plate.jpg
#
# A plate is a piece of labware made up of a number of {Well wells}. This class represents the physical piece of
Method do_cherrypick_task
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_cherrypick_task(_task, params) # rubocop:todo Metrics/CyclomaticComplexity
plates = params[:plate]
size = params[:plate_size]
plate_type = params[:plate_type]
Class Receptacle
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Receptacle < Asset # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include Commentable
include Transfer::State
include Aliquot::Remover
Complex method StudiesController#create (59.6) Open
def create # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
ActiveRecord::Base.transaction do
@study = Study.new(params['study'].merge(user: current_user))
@study.save!
current_user.grant_manager(@study)
- 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
const wrapper = shallowMount(PlatesSectionPlate, {
mocks: {
$store: {
state: { ...defaultState() },
getters: {},
- 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 107.
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
const wrapper = shallowMount(PlatesSectionPlate, {
mocks: {
$store: {
state: { ...defaultState() },
getters: {},
- 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 107.
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
Complex method namespace(jsorm)::task#create_config (58.7) Open
task create_config: :environment do
puts <<~HEREDOC
/*
* Autogenerated by sequencescape on #{Time.zone.now}"
* bundle exec rake jsorm:create_config"
- 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 Submission#next_requests_via_submission (58.5) Open
def next_requests_via_submission(request) # rubocop:todo Metrics/CyclomaticComplexity
raise "Request #{request.id} is not part of submission #{id}" unless request.submission_id == id
# Pick out the siblings of the request, so we can work out where it is in the list, and all of
# the requests in the subsequent request type, so that we can tie them up. We order by 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