<commit_before>module Evidence
  module Forms
    class Income < ::FormObject

      def self.permitted_attributes
        {
          id: Integer,
          amount: String
        }
      end

      define_attributes

      validates :amount, numericality: { greater_than_or_equal_to: 0 }

      def save
        if valid?
          persist!
          true
        else
          false
        end
      end

      private

      def format_amount
        self.amount = amount.to_f.round
      end

      def persist!
        @evidence = EvidenceCheck.find(id)
        format_amount
        result = income_calculation
        @evidence.update(income: amount, outcome: result[:outcome], amount_to_pay: result[:amount])
      end

      def income_calculation
        application = Application.find @evidence.application_id
        calculation_result = IncomeCalculation.new(application, amount.to_i).calculate
      end
    end
  end
end
<commit_msg>RuboCop style fix<commit_after>module Evidence
  module Forms
    class Income < ::FormObject

      def self.permitted_attributes
        {
          id: Integer,
          amount: String
        }
      end

      define_attributes

      validates :amount, numericality: { greater_than_or_equal_to: 0 }

      def save
        if valid?
          persist!
          true
        else
          false
        end
      end

      private

      def format_amount
        self.amount = amount.to_f.round
      end

      def persist!
        @evidence = EvidenceCheck.find(id)
        format_amount
        result = income_calculation
        @evidence.update(income: amount, outcome: result[:outcome], amount_to_pay: result[:amount])
      end

      def income_calculation
        application = Application.find @evidence.application_id
        IncomeCalculation.new(application, amount.to_i).calculate
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05994694960212202, 'fraction_numerical': 0.0010610079575596816, 'mean_word_length': 1.8793893129770993, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4992879', 'n_tokens_mistral': 542, 'n_tokens_neox': 498, 'n_words': 125}