<commit_before>local luacov_reporter = require("luacov.reporter")
local luatoxml = require("luacov.cobertura.luatoxml")

local ReporterBase = luacov_reporter.ReporterBase

-- ReporterBase provide
--  write(str) - write string to output file
--  config()   - return configuration table

local cobertura_reporter = setmetatable({}, ReporterBase) do
cobertura_reporter.__index = cobertura_reporter

function cobertura_reporter:new(conf)
	local o, err = ReporterBase.new(self, conf)
	if not o then
		return nil, err
	end

	if conf.cobertura.nameparser then
		local parsed_data = {}
		for filename,stats in pairs(o._data) do
			local parsed_filename = conf.cobertura.nameparser(filename)
			parsed_data[parsed_filename] = stats
		end
		o._data = parsed_data
	end

	return o
end

function cobertura_reporter:on_start()
	self.cobertura = {
		coverage = {<commit_msg>Changed name of cobertura specific config value<commit_after>local luacov_reporter = require("luacov.reporter")
local luatoxml = require("luacov.cobertura.luatoxml")

local ReporterBase = luacov_reporter.ReporterBase

-- ReporterBase provide
--  write(str) - write string to output file
--  config()   - return configuration table

local cobertura_reporter = setmetatable({}, ReporterBase) do
cobertura_reporter.__index = cobertura_reporter

function cobertura_reporter:new(conf)
	local o, err = ReporterBase.new(self, conf)
	if not o then
		return nil, err
	end

	if conf.cobertura.filenameparser then
		local parsed_data = {}
		for filename,stats in pairs(o._data) do
			local parsed_filename = conf.cobertura.filenameparser(filename)
			parsed_data[parsed_filename] = stats
		end
		o._data = parsed_data
	end

	return o
end

function cobertura_reporter:on_start()
	self.cobertura = {
		coverage = {
{'fraction_non_alphanumeric': 0.08522727272727272, 'fraction_numerical': 0.0, 'mean_word_length': 4.929292929292929, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3725955', 'n_tokens_mistral': 613, 'n_tokens_neox': 584, 'n_words': 144}