diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-09-25 21:13:30 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-09-26 15:52:45 -0400 |
commit | 21cc9d13f34d116b521c4415098ca1c9993bd198 (patch) | |
tree | 4e618b5378b13349f35aeb4e765dfe69eecbb3f8 /scripts/maint/annotate_ifdef_directives | |
parent | 194dbea24d1d05fa7b63b361b06054da4df011b9 (diff) | |
download | tor-21cc9d13f34d116b521c4415098ca1c9993bd198.tar.gz tor-21cc9d13f34d116b521c4415098ca1c9993bd198.zip |
annotate_ifdef_directives: clarify situation with newlines
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.
Diffstat (limited to 'scripts/maint/annotate_ifdef_directives')
-rwxr-xr-x | scripts/maint/annotate_ifdef_directives | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/maint/annotate_ifdef_directives b/scripts/maint/annotate_ifdef_directives index 4463d83828..b6bb147ce2 100755 --- a/scripts/maint/annotate_ifdef_directives +++ b/scripts/maint/annotate_ifdef_directives @@ -26,7 +26,10 @@ import re # Any block with fewer than this many lines does not need annotations. LINE_OBVIOUSNESS_LIMIT = 4 -# Maximum line width. +# Maximum line width. This includes a terminating newline character. +# +# (This is the maximum before encoding, so that if the the operating system +# uses multiple characers to encode newline, that's still okay.) LINE_WIDTH=80 class Problem(Exception): @@ -38,7 +41,10 @@ def commented_line(fmt, argument, maxwidth=LINE_WIDTH): be longer than maxwidth, truncate argument. Requires that fmt%"..." will fit into maxwidth characters. + + Requires that fmt ends with a newline. """ + assert fmt.endswith("\n") result = fmt % argument if len(result) <= maxwidth: return result |