Skip to content
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

Merged
merged 13 commits into from Sep 30, 2019

Conversation

Labels
None yet
Projects
None yet
5 participants
@nmathewson
Copy link
Contributor

@nmathewson nmathewson commented Sep 18, 2019

No description provided.

@coveralls
Copy link

@coveralls coveralls commented Sep 18, 2019

Pull Request Test Coverage Report for Build 6412

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 63.387%

Totals Coverage Status
Change from base Build 6404: 0.02%
Covered Lines: 47983
Relevant Lines: 75698

💛 - Coveralls

nmathewson added 3 commits Sep 23, 2019
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:
Copy link
Contributor

@tlyu tlyu Sep 24, 2019

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.

Copy link
Contributor

@teor2345 teor2345 Sep 24, 2019

Should we have a test case for 79 and 80 character lines?
Or is this script too small to have test cases?

Copy link
Contributor

@tlyu tlyu Sep 25, 2019

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.

nmathewson added 4 commits Sep 26, 2019
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
Copy link
Contributor

@tlyu tlyu Sep 27, 2019

Typo: "agument" should be "argument"

nmathewson added 6 commits Sep 28, 2019
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.
@torproject-pusher torproject-pusher merged commit fc1134e into torproject:master Sep 30, 2019
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment