<commit_before>defmodule CoursePlanner.Types.EntityType do
  @behaviour Ecto.Type
  def type, do: :string

  @valid_entity_types ['Planned', 'Active', 'Finished', 'Graduated', 'Frozen', 'Deleted']

  def valid_entity_types, do: @valid_entity_types

  def cast(value) do
    cond do
      Enum.member?(@valid_entity_types, value) -> value
      true -> :error
    end
  end

  def load(value), do: value

  def dump(value) do
    cond do
      Enum.member?(@valid_entity_types, value) -> value
      true -> :error
    end
  end
end
<commit_msg>Fixes some credo warning<commit_after>defmodule CoursePlanner.Types.EntityType do
  @moduledoc """
    This module introduces a custom type for Etco for checking status in the model
  """
  @behaviour Ecto.Type
  def type, do: :string

  @valid_entity_types ['Planned', 'Active', 'Finished', 'Graduated', 'Frozen', 'Deleted']

  def valid_entity_types, do: @valid_entity_types

  def cast(value) do
    case Enum.member?(@valid_entity_types, value) do
      :true  -> value
      :false -> :error
    end
  end

  def load(value), do: value

  def dump(value) do
    case Enum.member?(@valid_entity_types, value) do
      :true  -> value
      :false -> :error
    end
  end
end

{'fraction_non_alphanumeric': 0.11201962387571546, 'fraction_numerical': 0.0, 'mean_word_length': 3.325088339222615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '6415828', 'n_tokens_mistral': 417, 'n_tokens_neox': 404, 'n_words': 118}