twisted / twistedchecker

twistedchecker is a tool to automatically verify code against the Twisted coding standard.
MIT License
9 stars 13 forks source link

twistedchecker should think a comment starts in the middle of a docstring. #50

Closed ghost closed 9 years ago

ghost commented 10 years ago

"""

twisted checker things this is a comment and so

  1. Comments should begin with one whitespace
  2. The first letter of comment should be capitalized

This is particularly triggered with url fragments @see U{https://example.com/test#fragment} """


Imported from Launchpad using lp2gh.

adiroiban commented 9 years ago

Based on the provided example I tried to extend the checker to ignore comments inside docstrings.

Please check and let me know if changes make sense.

Thanks!

hawkowl commented 9 years ago

Other than those two comments, LGTM.

adiroiban commented 9 years ago

Many thanks for the review and suggesting a better test suite. The previous patch was buggy. I have fixed the code and updated the tests.


Also if the result file has no empty new line at the end the assertion fails with a confusing message like this one:

twistedchecker.functionaltests.comments
= Expected =        = Actual =
1:W9402             1:W9402
3:W9401             3:W9401
5:W9401             5:W9401
7:W9402             7:W9402
31:W9401            31:W9401
33:W9401            33:W9401
43:W9401            43:W9401

twistedchecker.test.test_functionaltests.FunctionalTests.test_twistedchecker_functionaltests_comments

this is due to an extra newline. To fix this, I have changed to code to strip the values before comparison.


Please check new changes

Thanks!

adiroiban commented 9 years ago

Typo fixed. Please review latest changes.

Thanks!