Issue #18 resolved

Pyroma returns score as a return code, breaking some CI tools

Laurens Van Houtven
created an issue

Because pyroma.main is an entrypoint script, the return value is used as the return code.

This broke my tox build because tox considers not-0 to be a failing retcode, and of course my wonderful application scores 10 ;-)

I would suggest:

  • Return 0 or None unconditionally (easy, not great: still breaks things that look for the retcode, except with false negatives instead of false positives)
  • Return 1 if ratings[1] else 0 (pretty easy, returns
  • Return 10 - ratings[0] (my favorite, still returns 0 on success, but gives you an idea of how bad the failure was, allowing people to consider score > something as a success if there is some issue they can't really fix)

Comments (5)

  1. Kristian Glass

    Just hit this myself.

    I'm with you on the 10 - ratings[0] with the caveat that pyroma currently returns 1 for things such as invalid options - those should probably be renumbered.

  2. Takeshi Komiya

    Hi Lennart Regebro ,

    Is the change at 107daff correct? It looks like pyroma:main() returns 2 if the rating is 0-7, 1 if the options are wrong, and 1 if the rating is 8-10 (not 0).

    So, I check my package, pyroma-1.6 returns 1 as exitcode:

    $ pyroma .; echo $?
    ------------------------------
    Checking .
    Found blockdiag
    ------------------------------
    Final rating: 10/10
    Your cheese is so fresh most people think it's a cream: Mascarpone
    ------------------------------
    1
    
  3. Log in to comment