add more info about CheckDetail into documentation
ClosedPublic

Authored by garretraziel on Aug 20 2014, 9:02 AM.

Details

Summary

Add some examples about CheckDetail usage into taskotron's
documentation

Test Plan

make html in docs/ directory

Diff Detail

Repository
rLTRN libtaskotron
Lint
Lint Skipped
Unit
Unit Tests Skipped
garretraziel retitled this revision from to add more info about CheckDetail into documentation.
garretraziel updated this object.
garretraziel edited the test plan for this revision. (Show Details)
garretraziel added a reviewer: tflink.
tflink requested changes to this revision.Aug 20 2014, 9:27 AM

Good start but it needs more structure and to be broken up a bit more. For the most part, content is good, though.

docs/source/writingtasks.rst
248

This at least needs to be in a new subsection instead of just tacked on at the end. "Working with CheckDetail Objects" seems like an appropriate title to me.

Also, breaking these examples into subsections or subsubsections with their own titles would break things up a bit more and create better direct links to the examples

371

I think this is a typo (o instead of on)? "for more information about APIs ..." might be a better wording here, though

This revision now requires changes to proceed.Aug 20 2014, 9:27 AM
jskladan accepted this revision.Aug 20 2014, 9:32 AM
jskladan added a reviewer: jskladan.
jskladan added a subscriber: jskladan.

Macro megusta:           lg                        tm

kparal requested changes to this revision.Aug 20 2014, 1:46 PM
kparal added inline comments.
docs/source/library.rst
20 ↗(On Diff #609)

If I open the rendered documentation in Firefox, there are automatic hyperlinks like library.html#module-libtaskotron.check. I wonder if that can be re-used instead of manually creating custom anchors?

docs/source/writingtasks.rst
249

A few clarifications here and below:
CheckDetail.store() is not used for output from several checks. It's used for output from a single check. If you execute several checks (e.g. rpmlint on several different builds), you should create several CheckDetails so that the results are reported separately.

CD.store() simply appends a string to CD.output, which is a list so that it is easy and convenient to work with it and you don't have to deal with line breaks. It doesn't matter whether you append a single line, or 100 lines - at the end, all of that is going to be concatenated together to a single big string -- the check log. CD.store() is a convenience method if you receive some output gradually and you want to store it and also print it at the same time (upgradepath does this). If you don't want to produce results/show progress in real time, and you want to populate CD just at the end, you can either use the constructor (if your CD doesn't exist yet), or directly assign to CD.output.

254–255

I think we should mention that the list together with the priorities is accessible as CD.outcome_priority.

256–258

Or you can directly set outcome as CD.outcome.

281

If we don't want to print progress to stream, let's change False to printout=False, so that it's obvious what it does without looking into documentation. But I think this can be one of the places where it actually makes sense to print it, so even if you run it manually in the terminal, you still see all the results easily. What about something like this?

for rpmfile, outcome in results:
    # e.g. "xchat-1.2-3.fc20.x86_64.rpm: FAILED"
    detail.store('%s: %s' % (os.path.basename(rpmfile), outcome))
    detail.update_outcome(outcome)
286

For the moment, we should append checkname='mytask' here, I guess.

293

And we will then get rid of $CHECKNAME here.

305–328

I'm not sure it's worth having examples even for not-that-important methods and attributes, and broken() seems to be one of them to me. I'd rather see concise documentation covering the most important and useful use cases, than very detailed documentation about every possible option.

330–369

In theory, yes, you can do this, but I don't want to even hint this to people until all of us agree it is a good idea. At the moment I'm very unclear what is the benefit of having smaller reporting units than builds (or build-arches). Currently we suppose we will allow people to define their own item_type, so we can't stop them from reporting results per-rpm or even per-file(!). But imagine what this could do to our database. In the end, we will need to introduce some reporting limits, I think. So I wouldn't include this piece of documentation until we're clearer on this topic. Sorry about that, I know it took some time to write this.

garretraziel updated this revision to Diff 620.Aug 21 2014, 9:48 AM
  • changes to CheckDetail examples in docs
kparal accepted this revision.Aug 21 2014, 11:54 AM

Please change the typo and it's OK.

docs/source/writingtasks.rst
256

Typo outcome_priority -> outcome

garretraziel closed this revision.Aug 21 2014, 12:04 PM
garretraziel updated this revision to Diff 622.

Closed by commit rLTRNd369e3a2e9b3 (authored by Garret Raziel <boloomka@gmail.com>).