<commit_before># frozen_string_literal: true

class Verification::Validator::OutdatedPlatesScanned < ActiveModel::Validator
  # rubocop:todo Metrics/MethodLength
  def validate(record) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    labware = record.labware_from_barcodes(record.scanned_values)
    labware.each do |barcode, plate|
      if plate.nil?
        record.errors.add(:error, "The labware #{barcode} hasn't been found")
        next
      end
      if plate.purpose.lifespan.nil?
        record.errors.add(:error, "The labware #{barcode} can't be destroyed because it's a #{plate.purpose.name}")
        next
      end
      next unless plate.created_at > plate.purpose.lifespan.days.ago
      record.errors.add(:error, "The labware #{barcode} is less than #{plate.purpose.lifespan} days old")
      next
    end
    record.errors.add(:base, 'No labware found') if labware.empty?
  end
  # rubocop:enable Metrics/MethodLength
end<commit_msg>missed a bit of renaming<commit_after># frozen_string_literal: true

class Verification::Validator::OutdatedPlatesScanned < ActiveModel::Validator
  # rubocop:todo Metrics/MethodLength
  def validate(record) # rubocop:todo Metrics/AbcSize, Metrics/MethodLength
    labware_list = record.labware_from_barcodes(record.scanned_values)
    labware_list.each do |barcode, labw|
      if labw.nil?
        record.errors.add(:error, "The labware #{barcode} hasn't been found")
        next
      end
      if labw.purpose.lifespan.nil?
        record.errors.add(:error, "The labware #{barcode} can't be destroyed because it's a #{labw.purpose.name}")
        next
      end
      next unless labw.created_at > labw.purpose.lifespan.days.ago
      record.errors.add(:error, "The labware #{barcode} is less than #{labw.purpose.lifespan} days old")
      next
    end
    record.errors.add(:base, 'No labware found') if labware_list.empty?
  end
  # rubocop:enable Metrics/MethodLength
end
{'fraction_non_alphanumeric': 0.10520887055183084, 'fraction_numerical': 0.0, 'mean_word_length': 3.6973365617433416, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4151830', 'n_tokens_mistral': 632, 'n_tokens_neox': 617, 'n_words': 145}