Showing 5,431 of 5,433 total issues
Complex method Core::Io::Base::JsonFormattingBehaviour::Input::AssociationHandling#handle_has_many (45.8) Open
def handle_has_many(attributes, attribute, json, object) # rubocop:todo Metrics/CyclomaticComplexity
if json.first.is_a?(Hash)
uuids = Uuid.include_resource.lookup_many_uuids(json.filter_map { |j| j['uuid'] })
uuid_to_resource = uuids.each_with_object({}) { |uuid, hash| hash[uuid.external_id] = uuid.resource }
mapped_attributes =
- 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 test_worksheet.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_dependency 'sample_manifest_excel/tags'
module SampleManifestExcel
module Worksheet
##
Method generate_json_to_object_mapping
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_json_to_object_mapping(json_to_attribute) # rubocop:todo Metrics/CyclomaticComplexity
code = []
# Split the mappings into two to make things easier. Read only attributes are easily
# handled right now, provided there is not a read_write one that shares their name.
File well.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Well < Receptacle # rubocop:todo Metrics/ClassLength
include Api::WellIO::Extensions
include ModelExtensions::Well
include Cherrypick::VolumeByNanoGrams
include Cherrypick::VolumeByNanoGramsPerMicroLitre
Complex method ReceptaclesController#index (45.3) Open
def index # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
if params[:study_id]
@study = Study.find(params[:study_id])
@assets = @study.assets_through_aliquots.order(created_at: :desc).page(params[:page])
else
- 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 stage
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def stage # rubocop:todo Metrics/CyclomaticComplexity
@workflow = Workflow.includes(:tasks).find(params[:workflow_id])
@stage = params[:id].to_i
@task = @workflow.tasks[@stage]
- 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
it("registers a pick if none exists", () => {
// mock state
const state = defaultState();
const new_pick = pick1({ id: 1 });
// apply mutation
- 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 83.
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
it("registers a plate if none exists", () => {
// mock state
const state = defaultState();
const new_plate = pendingScannedPlate({ id: 1 });
// apply mutation
- 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 83.
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 CherrypickTask#build_plate_wells_from_requests (44.8) Open
def build_plate_wells_from_requests(requests, workflow_controller = nil) # rubocop:todo Metrics/AbcSize
loaded_requests = Request.where(requests: { id: requests }).includes(asset: [{ plate: :barcodes }, :map])
source_plate_barcodes = loaded_requests.map { |request| request.asset.plate.human_barcode }.uniq
- 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 StudiesController::role_helper (44.5) Open
def self.role_helper(name, success_action, error_action) # rubocop:todo Metrics/AbcSize
define_method(:"#{name}_role") do
ActiveRecord::Base.transaction do
@study = Study.find(params[:id])
@user = User.find(params.require(:role).fetch(:user))
- 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 Accessionable::Sample#initialize (44.3) Open
def initialize(sample) # rubocop:todo Metrics/CyclomaticComplexity
@sample = sample
super(sample.ebi_accession_number)
sampname = sample.sample_metadata.sample_public_name
- 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
def lookup # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
return unless params[:asset] && params[:asset][:barcode]
@assets = Labware.with_barcode(params[:asset][:barcode]).limit(50).page(params[:page])
- 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 88.
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
const wrapper = shallowMount(PicksSectionBatchPick, {
propsData: {
name,
short,
id: "1",
- 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 82.
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
def lookup # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
return unless params[:asset] && params[:asset][:barcode]
@assets = Labware.with_barcode(params[:asset][:barcode]).limit(50).page(params[:page])
- 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 88.
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
const wrapper = shallowMount(PicksSectionBatchPick, {
propsData: {
name,
short,
id: "1",
- 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 82.
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 ProjectsController#remove_role (44.2) Open
def remove_role # rubocop:todo Metrics/AbcSize
@user = User.find(params[:role][:user])
@project = Project.find(params[:id])
@role = Role.find_by(name: params[:role][:authorizable_type])
- 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 ProjectsController#grant_role (44.2) Open
def grant_role # rubocop:todo Metrics/AbcSize
@user = User.find(params[:role][:user])
@project = Project.find(params[:id])
@role = Role.find_by(name: params[:role][:authorizable_type])
- 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(devour)::task#create_config (44.1) Open
task create_config: :environment do
# We prettify are json to make it both easier to read and diff
json_formatting = { indent: ' ', object_nl: "\n", space: ' ', array_nl: "\n" }
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
Class SampleManifest
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SampleManifest < ApplicationRecord # rubocop:todo Metrics/ClassLength
include Uuid::Uuidable
include ModelExtensions::SampleManifest
include SampleManifest::BarcodePrinterBehaviour
include SampleManifest::CoreBehaviour
Class Base
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
MANDATORY_FIELDS = %w[country_of_origin date_of_sample_collection].freeze
include ActiveModel::Model
include SequencescapeExcel::SubclassChecker