<commit_before>require "cukerail/version"
require "cukerail/testrail"
# require_relative "cucumber_extensions/formatters/json/builder"
# puts 'load extensions'
# puts (Cucumber::Formatter.name)
# Cucumber::Formatter::Json::Builder.include CucumberExtensions::Formatter::Json::Builder
module Cukerail
  class Sender
    attr_reader :testrail_api_client,:failed_step
    def initialize(runtime, io, options)
      if %w(BASE_URL USER PASSWORD).map{|e| ENV["TESTRAIL_#{e}"]}.any?{|e| e=='' || !e}
        raise 'You need to setup Testrail environment parameters see https://bbcworldwide.atlassian.net/wiki/display/BAR/Installing+and+Running+Cukerail' 
      end
      @testrail_api_client = TestRail::APIClient.new(ENV['TESTRAIL_BASE_URL'],ENV['TESTRAIL_USER'],ENV['TESTRAIL_PASSWORD'],ENV['TESTRAIL_PROXY_URL'],ENV['TESTRAIL_PROXY_PORT'])
    end

    def after_test_case(test_case,result)
      #guard clause
      return false unless test_case.tags.any?{|tag| tag.name =~/project/} && test_case.tags.any?{|tag| tag.name=~/suite/} 
      feature = test_case.feature
      #      ap feature.methods - Object.methods
      #      ap feature.tags
      @id = get_id(test_case)
      raise 'No id found' unless @id
      send_steps(test_case,@id)<commit_msg>started on updating souce feature files<commit_after>require "cukerail/version"
require "cukerail/testrail"
# require_relative "cucumber_extensions/formatters/json/builder"
# puts 'load extensions'
# puts (Cucumber::Formatter.name)
# Cucumber::Formatter::Json::Builder.include CucumberExtensions::Formatter::Json::Builder
module Cukerail
  class Sender
    attr_reader :testrail_api_client,:failed_step
    def initialize(runtime, io, options)
      if %w(BASE_URL USER PASSWORD).map{|e| ENV["TESTRAIL_#{e}"]}.any?{|e| e=='' || !e}
        raise 'You need to setup Testrail environment parameters see https://bbcworldwide.atlassian.net/wiki/display/BAR/Installing+and+Running+Cukerail' 
      end
      @testrail_api_client = TestRail::APIClient.new(ENV['TESTRAIL_BASE_URL'],ENV['TESTRAIL_USER'],ENV['TESTRAIL_PASSWORD'],ENV['TESTRAIL_PROXY_URL'],ENV['TESTRAIL_PROXY_PORT'])
    end

    def after_test_case(test_case,result)
      #guard clause
      return false unless test_case.tags.any?{|tag| tag.name =~/project/} && test_case.tags.any?{|tag| tag.name=~/suite/} 
      feature = test_case.feature
      #      ap feature.methods - Object.methods
      #      ap feature.tags
      @id = get_id(test_case)
      raise 'No id found' unless @id
      send_steps(test_case,@id)
      if ENV['UPDATE_SOURCE']
        update_source_file(test_case,@id)
      end
{'fraction_non_alphanumeric': 0.13083397092578425, 'fraction_numerical': 0.0, 'mean_word_length': 4.540254237288136, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '6047258', 'n_tokens_mistral': 902, 'n_tokens_neox': 879, 'n_words': 152}