<div dir="ltr">Hello.<div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 23, 2014 at 6:47 AM, ZhiQiang Fan <span dir="ltr"><<a href="mailto:aji.zqfan@gmail.com" target="_blank">aji.zqfan@gmail.com</a>></span> wrote: <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div><div><div><div><div>I noticed that in openstack-dev/hacking project, there is very little test code, is there any particular reason why it is in such situation?<br></div></div></div></div></div></div>
</blockquote>
<div><br></div><div>Yes, there is. Every rule have a docstring that not only provides examples of good and bad code but also is run as a doctest here: <a href="https://github.com/openstack-dev/hacking/blob/master/hacking/tests/test_doctest.py">https://github.com/openstack-dev/hacking/blob/master/hacking/tests/test_doctest.py</a></div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><a href="https://github.com/openstack-dev/hacking/blob/master/hacking/core.py#L345" target="_blank">https://github.com/openstack-dev/hacking/blob/master/hacking/core.py#L345</a><br>
</div>
it cannot detect<br><br></div>\bprint$<br></div>\bprint >>>xxx, (\s+<br></div></div></div></blockquote><div><br></div><div>I'm not sure how can it not detect the second one since the regular expression used there to detect bad strings is "\bprint\s+[^\(]" and it catches "print >>>xxx, (" string.</div>
<div>The first one is a good catch though.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>If I want to improve this rule, how can I verify that my change is good?<br></div></div></blockquote><div><br></div><div>Just change that regular expression as is needed and add a line to the docstring like these:</div>
<div>Okay: print()</div><div>H233: print</div><div><br></div><div>Happy coding!</div></div><div><br></div>-- <br><br><div>Kind regards, Yuriy.</div>
</div></div>