fix(ci): inline functions

This commit is contained in:
Barrett Ruth 2025-09-20 23:58:26 -04:00
parent 7b8aae7921
commit 5bf9ae731f
3 changed files with 14 additions and 18 deletions

View file

@ -21,10 +21,6 @@ local function get_plugin_path()
return vim.fn.fnamemodify(plugin_path, ':h:h:h')
end
local function ensure_io_directory()
vim.fn.mkdir('io', 'p')
end
local function check_internet_connectivity()
local result = vim.system({ 'ping', '-c', '1', '-W', '3', '8.8.8.8' }, { text = true }):wait()
return result.code == 0
@ -144,7 +140,7 @@ function M.scrape_problem(ctx)
ctx = { ctx, 'table' },
})
ensure_io_directory()
vim.fn.mkdir('io', 'p')
if vim.fn.filereadable(ctx.input_file) == 1 and vim.fn.filereadable(ctx.expected_file) == 1 then
local base_name = vim.fn.fnamemodify(ctx.input_file, ':r')
@ -373,7 +369,16 @@ function M.scrape_problems_parallel(platform, contest_id, problems, config)
scrape_result = data
if data.tests and #data.tests > 0 then
local ctx = problem.create_context(platform, contest_id, problem_id, config)
local ctx_contest_id, ctx_problem_id
if platform == 'cses' then
ctx_contest_id = problem_id
ctx_problem_id = nil
else
ctx_contest_id = contest_id
ctx_problem_id = problem_id
end
local ctx = problem.create_context(platform, ctx_contest_id, ctx_problem_id, config)
local base_name = vim.fn.fnamemodify(ctx.input_file, ':r')
for i, test_case in ipairs(data.tests) do