Conversation
| params do | ||
| requires :chemical_data, type: Array[Hash], desc: 'chemical data' | ||
| optional :cas, type: String, desc: 'cas number' | ||
| optional :sample_id, type: Integer |
There was a problem hiding this comment.
Metrics/ClassLength: Class has too many lines. [205/200]
| -- molecules | ||
| inner join molecules m on s.molecule_id = m.id | ||
| where rsm.reaction_id in (#{selection}) | ||
|
|
There was a problem hiding this comment.
Metrics/ModuleLength: Module has too many lines. [913/100]
| -- molecules | ||
| inner join molecules m on s.molecule_id = m.id | ||
| where rsm.reaction_id in (#{selection}) | ||
|
|
There was a problem hiding this comment.
Metrics/MethodLength: Method has too many lines. [104/30]
| # desc: SM.R>>P | ||
| def r_smiles_1(v) | ||
| ((v['0'] || []) + (v['1'] || [])).join('.') \ | ||
| ((v['0'] || []) + formatted_reactants(v['1'])).join('.') \ |
There was a problem hiding this comment.
Style/StringConcatenation: Prefer string interpolation to string concatenation.
| # desc: SM.R.S>>P | ||
| def r_smiles_2(v) | ||
| ((v['0'] || []) + (v['1'] || []) + (v['2'] || [])).join('.') \ | ||
| ((v['0'] || []) + formatted_reactants(v['1']) + (v['2'] || [])).join('.') \ |
There was a problem hiding this comment.
Style/StringConcatenation: Prefer string interpolation to string concatenation.
| super | ||
| end | ||
|
|
||
| def is_new |
There was a problem hiding this comment.
Naming/PredicatePrefix: Rename is_new to new?.
| to_boolean super | ||
| end | ||
|
|
||
| def to_boolean(string) |
There was a problem hiding this comment.
Naming/PredicateMethod: Predicate method names should end with ?.
| solvent: Array(materials['solvents']).map { |m| OSample.new(m) }, | ||
| purification_solvent: Array(materials['purification_solvents']).map { |m| OSample.new(m) }, | ||
| product: Array(materials['products']).map { |m| OSample.new(m) }, | ||
| reactant_sbmm: Array(materials['reactant_sbmm_samples'] || []).map { |m| OSbmmSample.new(m) }, |
There was a problem hiding this comment.
Metrics/ClassLength: Class has too many lines. [357/200]
| solvent: Array(materials['solvents']).map { |m| OSample.new(m) }, | ||
| purification_solvent: Array(materials['purification_solvents']).map { |m| OSample.new(m) }, | ||
| product: Array(materials['products']).map { |m| OSample.new(m) }, | ||
| reactant_sbmm: Array(materials['reactant_sbmm_samples'] || []).map { |m| OSbmmSample.new(m) }, |
There was a problem hiding this comment.
Metrics/AbcSize: Assignment Branch Condition size for initialize is too high. [<10, 24, 7> 26.93/25]
| solvent: Array(materials['solvents']).map { |m| OSample.new(m) }, | ||
| purification_solvent: Array(materials['purification_solvents']).map { |m| OSample.new(m) }, | ||
| product: Array(materials['products']).map { |m| OSample.new(m) }, | ||
| reactant_sbmm: Array(materials['reactant_sbmm_samples'] || []).map { |m| OSbmmSample.new(m) }, |
There was a problem hiding this comment.
Metrics/CyclomaticComplexity: Cyclomatic complexity for initialize is too high. [8/7]
| end | ||
| ActiveRecord::Base.transaction do | ||
| modified_sample_ids = [] | ||
| modified_sbmm_ids = [] |
There was a problem hiding this comment.
Metrics/AbcSize: Assignment Branch Condition size for execute! is too high. [<17, 39, 26> 49.86/25]
| end | ||
| ActiveRecord::Base.transaction do | ||
| modified_sample_ids = [] | ||
| modified_sbmm_ids = [] |
There was a problem hiding this comment.
Metrics/CyclomaticComplexity: Cyclomatic complexity for execute! is too high. [19/7]
| end | ||
| ActiveRecord::Base.transaction do | ||
| modified_sample_ids = [] | ||
| modified_sbmm_ids = [] |
There was a problem hiding this comment.
Metrics/MethodLength: Method has too many lines. [61/30]
| end | ||
| ActiveRecord::Base.transaction do | ||
| modified_sample_ids = [] | ||
| modified_sbmm_ids = [] |
There was a problem hiding this comment.
Metrics/PerceivedComplexity: Perceived complexity for execute! is too high. [22/8]
| end | ||
| ActiveRecord::Base.transaction do | ||
| modified_sample_ids = [] | ||
| modified_sbmm_ids = [] |
There was a problem hiding this comment.
Metrics/BlockLength: Block has too many lines. [42/25]
| Array(obj.reactant_sbmm_samples) | ||
| end | ||
|
|
||
| def sbmm_material_hash(material) |
There was a problem hiding this comment.
Metrics/PerceivedComplexity: Perceived complexity for sbmm_material_hash is too high. [12/8]
| end | ||
|
|
||
| def sbmm_material_hash(material) | ||
| s = OpenStruct.new(material) |
There was a problem hiding this comment.
Style/OpenStructUse: Avoid using OpenStruct; use Struct, Hash, a class or test doubles instead.
| molecule_name_hash: { label: sbmm_name }, | ||
| components: [], | ||
| is_mixture: false, | ||
| weight_percentage: (@obj.weight_percentage && s.weight_percentage.present?) ? valid_digit(s.weight_percentage, digit) : '', |
There was a problem hiding this comment.
Style/TernaryParentheses: Omit parentheses for ternary conditions.
| molecule_name_hash: { label: sbmm_name }, | ||
| components: [], | ||
| is_mixture: false, | ||
| weight_percentage: (@obj.weight_percentage && s.weight_percentage.present?) ? valid_digit(s.weight_percentage, digit) : '', |
There was a problem hiding this comment.
Layout/LineLength: Line is too long. [133/120]
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Metrics/AbcSize: Assignment Branch Condition size for materials_table_delta is too high. [<18, 40, 3> 43.97/25]
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Metrics/MethodLength: Method has too many lines. [35/30]
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Layout/SpaceAroundOperators: Surrounding space missing for operator =>.
| { 'insert' => '} ' }, | ||
| *sample_molecule_name_delta(m), | ||
| { 'insert' => " (#{valid_digit(m[:vol], 2)} mL); " }] | ||
| {"insert"=>" (#{valid_digit(m[:vol], 2)} #{normalize_liter_unit(m[:vol_unit])}); "}] |
There was a problem hiding this comment.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
| let!(:s2) { create(:sample, name: 'Sample 2') } | ||
| let!(:s3) { create(:sample, name: 'Sample 3') } | ||
| let!(:s4) { create(:sample, name: 'Solvent') } | ||
| let!(:sbmm) { create(:uniprot_sbmm) } |
There was a problem hiding this comment.
RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [35/10]
| end | ||
|
|
||
| it 'has correct content' do | ||
| sbmm_reactant = content[:reactants].find { |r| r[:short_label] == sbmm_sample.short_label } |
There was a problem hiding this comment.
RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [36/10]
| { 'insert' => '} ' }, | ||
| { 'attributes' => { 'bold' => false, 'font-size' => 12 }, 'insert' => s4.preferred_label }, | ||
| { 'insert' => ' (56 mL); ' }, | ||
| { 'insert' => ' (56 ml); ' }, |
There was a problem hiding this comment.
RSpec/MultipleMemoizedHelpers: Example group has too many memoized helpers [35/10]
| expect(formula['O']).to be_within(1e-10).of(1.5) | ||
| end | ||
|
|
||
| it 'accepts hash fragments with symbol keys' do |
There was a problem hiding this comment.
RSpec/MultipleExpectations: Example has too many expectations [4/3].
| expect(formula['O']).to be_within(1e-10).of(0.5) | ||
| end | ||
|
|
||
| it 'accepts hash fragments with symbol keys' do |
There was a problem hiding this comment.
RSpec/MultipleExpectations: Example has too many expectations [4/3].
LCOV of commit
|
LCOV of commit
|
LCOV of commit
|
b53e939 to
6e6f504
Compare
LCOV of commit
|
| scope = @shared_methods.order_by_molecule(scope) if @conditions[:model_name] == Sample | ||
| scope = scope.group("#{@conditions[:model_name].table_name}.id") if group_by_model_name | ||
| scope = scope.group('samples.id, molecules.sum_formular') if @conditions[:model_name] == Sample | ||
| scope = @shared_methods.order_by_created_at_desc(scope) if @conditions[:model_name] == Reaction |
There was a problem hiding this comment.
Metrics/AbcSize: Assignment Branch Condition size for basic_scope is too high. [<8, 24, 11> 27.59/25]
| end | ||
|
|
||
| def order_by_created_at_desc(scope) | ||
| scope.order('created_at DESC') |
There was a problem hiding this comment.
Rails/OrderArguments: Prefer created_at: :desc instead.
LCOV of commit
|
No description provided.