74721fc Revise Pagure comment parsers, make more liberal

2 files Authored by adamwill 3 years ago, Committed by kparal 3 years ago,
    Revise Pagure comment parsers, make more liberal
    
    This is an alternative to #160 that rewrites the line parsers.
    Broadly we use a small set of simple regexes as constants (rather
    than constructing more complex regexes on the fly from keyword
    constants). We factor out the similarity in how the former
    agreed_parser and revote_parser worked. We also fix #155 by
    accepting both "FE" and "FreezeException".
    
    We fix #153 even harder than required, by accepting any number of
    pairs of TRACKER and VOTE in any order with arbitrary whitespace
    (so you can vote multiple times on a line if you like, as on IRC).
    You still can't have any non-vote text in the line. For agreeds
    and revotes, the behaviour should be the same as before but with
    a different implementation. The on-the-fly regexes that were being
    used here behaved a bit oddly in general, if you extract them out
    and play around with them. The old code avoided most consequences
    of the weirdness by only using them for initial matching and then
    not using capture groups but just iterating over the KEYWORDS
    constants, but it still made things a bit hard to follow. I think
    it's clearer this way. This way also deals elegantly with
    whitespace issues.
    
    I stole the inverted tests from Lukas' #160, thanks.
    
    Fixes: https://pagure.io/fedora-qa/blockerbugs/issue/153
    Fixes: https://pagure.io/fedora-qa/blockerbugs/issue/155
    Closes: https://pagure.io/fedora-qa/blockerbugs/pull-request/160
    Merges: https://pagure.io/fedora-qa/blockerbugs/pull-request/161
    
    Signed-off-by: Adam Williamson <awilliam@redhat.com>
    
        
file modified
+65 -55
file modified
+281 -93