# HG changeset patch # User Simon Heimberg # Date 2013-11-05 08:00:31 # Node ID 289bbb294e824e4afed3796d5b23955de9b4a85b # Parent de16c673455b230cb5960565785c1e2af72d758f check-code: check comment for '.. note::' without two newlines Because string entries are replaced before matching, we must search for the transformed pattern. But it seems to be quite unique and does not return false matches. If it will, they can be listed as 3rd arg in pypats. diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -263,6 +263,7 @@ pypats = [ ], # warnings [ + (r'(^| )oo +xxxxoo[ \n][^\n]', "add two newlines after '.. note::'"), ] ] diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -204,3 +204,42 @@ don't use old-style two-argument raise, use Exception(message) [1] + $ cat > rst.py < """problematic rst text + > + > .. note:: + > wrong + > """ + > + > ''' + > + > .. note:: + > + > valid + > + > new text + > + > .. note:: + > + > also valid + > ''' + > + > """mixed + > + > .. note:: + > + > good + > + > .. note:: + > plus bad + > """ + > EOF + $ $check_code -w rst.py + rst.py:3: + > .. note:: + warning: add two newlines after '.. note::' + rst.py:26: + > .. note:: + warning: add two newlines after '.. note::' + [1] +