<commit_before>require 'hirb'

# based on http://www.natontesting.com/2010/01/11/updated-script-to-list-all-cucumber-step-definitions/
namespace :cucumber do
  desc 'List all defined steps'
  task :steps do
    extend Hirb::Console
    puts "CUCUMBER steps:"
    puts ""
    step_definition_dir = "features/step_definitions"

    Dir.glob(File.join(step_definition_dir,'**/*.rb')).each do |step_file|
      puts "File: #{step_file}"
      puts ""
      results = []
      File.new(step_file).read.each_line.each_with_index do |line, number|

        next unless line =~ /^\s*(?:Given|When|Then)\s+|\//
        res = /(?:Given|When|Then)[\s\(]*\/(.*)\/([imxo]*)[\s\)]*do\s*(?:$|\|(.*)\|)/.match(line)<commit_msg>Require hirb only when running cucumber:steps task.<commit_after># based on http://www.natontesting.com/2010/01/11/updated-script-to-list-all-cucumber-step-definitions/
namespace :cucumber do
  desc 'List all defined steps'
  task :steps do
    require 'hirb'

    extend Hirb::Console
    puts "CUCUMBER steps:"
    puts ""
    step_definition_dir = "features/step_definitions"

    Dir.glob(File.join(step_definition_dir,'**/*.rb')).each do |step_file|
      puts "File: #{step_file}"
      puts ""
      results = []
      File.new(step_file).read.each_line.each_with_index do |line, number|

        next unless line =~ /^\s*(?:Given|When|Then)\s+|\//
        res = /(?:Given|When|Then)[\s\(]*\/(.*)\/([imxo]*)[\s\)]*do\s*(?:$|\|(.*)\|)/.match(line)
{'fraction_non_alphanumeric': 0.20081967213114754, 'fraction_numerical': 0.01092896174863388, 'mean_word_length': 3.3088235294117645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2948987', 'n_tokens_mistral': 554, 'n_tokens_neox': 538, 'n_words': 90}