This is to fix T143 and display a real check name in TAP output. Since we
don't want to both user with some argument passing, we want to do this out of the box.
I haven't found any better approach than to use a global variable - an instance of
Context class.
To minimize the risks introduced by global variables, this class contains only
static data and it's fully populated on runner start. This ensures that we don't
fall into the biggest trap of global objects - if program behavior got modified
based on global object state. That usually leads to hard to debug problems.
With the current approach - only static data and spanning the whole life cycle,
we should avoid the most obvious pitfalls.
Once I had Context class ready, I realized it would be useful also outside TAP·
generation code. In particular, all the directives needed access to the same data
(workdir, job_id, check name), which we merged (without any clear distinction)
into envdata and passed it to them. But these values are really very close to what
"context" means - again, static immutable data.
So I used Context for this as well, and I was able to get rid of envdata from directives.
Now they use only input_data, which I believe looks simpler and more reasonable.
I use some new terminology in my patch, mainly I use "task recipe" instead of·
"task yaml file". I hit this problem when trying to reasonably name Context variables·
and our current terminology seemed a bit unclear to me. There might be a multiple
yaml files in the directory in the future, and then we will be confused. I think
it's helpful to use some analogies as other projects do, so that's why I started
calling "taskyaml file" as a "task recipe", per Josef's suggestion. If nobody objects,
I'd file a ticket to make sure the rest of the code and docs follow the same
naming. I have a few more suggestion, I'll put that into that new ticket.