torproject / tor Public
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ticket31759: improvements to annotate_ifdef_directives #1339
Conversation
Pull Request Test Coverage Report for Build 6412
|
No functional change in this commit.
If we would add a comment making a line longer than 80 columns, instead truncate the variable portion of the comment until it just fits into 80 columns, with an ellipsis.
| """ | ||
| return fmt % argument | ||
| result = fmt % argument | ||
| if len(result) <= maxwidth: |
I think this will allow a 80-character line. doc/HACKING/Codingstyle.md says 79 characters per line, and checkSpaces.pl seems to enforce 79.
Should we have a test case for 79 and 80 character lines?
Or is this script too small to have test cases?
Should we have a test case for 79 and 80 character lines?
Or is this script too small to have test cases?
I think that's a great idea to have a test case for 79 vs 80 character lines.
This change should reduce the number of cases where we say "/* !(!defined(foo)) */" . This only does cases where we can use a regex to make sure that the simplification is guaranteed to be correct. Full boolean simplification would require this script to parse C, and nobody wants that.
Our line limit is 80 characters, assuming that there is a single terminating newline character that counts towards the limit. On Windows, this might go as high as 81 characters, if we count CRLF as two characters.
| if len(result) <= maxwidth: | ||
| return result | ||
| else: | ||
| # How long can we let the agument be? Try filling in the |
This algorithm is not fully general, but it strikes a balance between efficiency, simplicity, and correctness.
This allows the python doctest module to process it correctly when invoked as: python -m doctest -v annotate_ifdef_directives.py
An 80-character line (79 characters if you don't count the newline) should not be truncated, and should not have a "..." insterted.
No description provided.
The text was updated successfully, but these errors were encountered: