<commit_before>local helper = {}

local function get_lua()
   local index = -1
   local res = "lua"

   while arg[index] do
      res = arg[index]
      index = index - 1
   end

   return res
end

local dir_sep = package.config:sub(1, 1)

-- Return path to root directory when run from `path`.
local function antipath(path)
   local _, level = path:gsub("[/\\]", "")
   return (".."..dir_sep):rep(level)
end

function helper.luacov_config(prefix)
   return {
      statsfile = prefix.."luacov.stats.out",
      modules = {
         luacheck = "src/luacheck/init.lua",
         ["luacheck.*"] = "src"
      },
      exclude = {
         "bin/luacheck$"
      }
   }
end

local luacov = package.loaded["luacov.runner"]
local lua

-- Returns command that runs `luacheck` executable from `loc_path`.
function helper.luacheck_command(loc_path)<commit_msg>Fix luacheck.stages.* modules being ignored by luacov<commit_after>local helper = {}

local function get_lua()
   local index = -1
   local res = "lua"

   while arg[index] do
      res = arg[index]
      index = index - 1
   end

   return res
end

local dir_sep = package.config:sub(1, 1)

-- Return path to root directory when run from `path`.
local function antipath(path)
   local _, level = path:gsub("[/\\]", "")
   return (".."..dir_sep):rep(level)
end

function helper.luacov_config(prefix)
   return {
      statsfile = prefix.."luacov.stats.out",
      modules = {
         luacheck = "src/luacheck/init.lua",
         ["luacheck.*"] = "src",
         ["luacheck.*.*"] = "src"
      },
      exclude = {
         "bin/luacheck$"
      }
   }
end

local luacov = package.loaded["luacov.runner"]
local lua

-- Returns command that runs `luacheck` executable from `loc_path`.
function helper.luacheck_command(loc_path)
{'fraction_non_alphanumeric': 0.1389983117613956, 'fraction_numerical': 0.004501969611705121, 'mean_word_length': 2.681159420289855, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4844216', 'n_tokens_mistral': 611, 'n_tokens_neox': 594, 'n_words': 153}