<commit_before>FactoryGirl.define do
  sequence(:published_path) { |n| "fake_path#{n}" }
  factory :procedure do
    lien_demarche 'http://localhost'
    sequence(:libelle) { |n| "Procedure #{n}" }
    description "Demande de subvention à l'intention des associations"
    organisation "Orga SGMAP"
    direction "direction SGMAP"
    published false
    cerfa_flag false
    administrateur { create(:administrateur) }

    after(:build) do |procedure, _evaluator|
      if procedure.module_api_carto.nil?
        module_api_carto = create(:module_api_carto)
        procedure.module_api_carto = module_api_carto
      end
    end

    trait :with_api_carto do
      after(:build) do |procedure, _evaluator|
        procedure.module_api_carto.use_api_carto = true
      end
    end

    trait :for_individual do
      after(:build) do |procedure, _evaluator|
        procedure.for_individual = true
      end
    end

    trait :with_type_de_champ do
      after(:build) do |procedure, _evaluator|
        type_de_champ = create(:type_de_champ_public)

        procedure.types_de_champ << type_de_champ
      end
    end

    trait :with_type_de_champ_private do
      after(:build) do |procedure, _evaluator|
        type_de_champ = create(:type_de_champ_private)
<commit_msg>Improve the Procedure factory<commit_after>FactoryGirl.define do
  sequence(:published_path) { |n| "fake_path#{n}" }
  factory :procedure do
    lien_demarche 'http://localhost'
    sequence(:libelle) { |n| "Procedure #{n}" }
    description "Demande de subvention à l'intention des associations"
    organisation "Orga SGMAP"
    direction "direction SGMAP"
    published false
    cerfa_flag false
    administrateur { create(:administrateur) }

    after(:build) do |procedure, _evaluator|
      if procedure.module_api_carto.nil?
        module_api_carto = create(:module_api_carto)
        procedure.module_api_carto = module_api_carto
      end
    end

    trait :with_api_carto do
      after(:build) do |procedure, _evaluator|
        procedure.module_api_carto.use_api_carto = true
      end
    end

    trait :for_individual do
      after(:build) do |procedure, _evaluator|
        procedure.for_individual = true
      end
    end

    trait :with_type_de_champ do
      transient do
        types_de_champ_count 1
      end

      after(:build) do |procedure, evaluator|
        evaluator.types_de_champ_count.times do
          type_de_champ = create(:type_de_champ_public)

          procedure.types_de_champ << type_de_champ
        end
      end
    end

    trait :with_type_de_champ_private do
      after(:build) do |procedure, _evaluator|
        type_de_champ = create(:type_de_champ_private)

{'fraction_non_alphanumeric': 0.07869339272457312, 'fraction_numerical': 0.0003711952487008166, 'mean_word_length': 3.101978691019787, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4010560', 'n_tokens_mistral': 888, 'n_tokens_neox': 871, 'n_words': 191}