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

check_format: adding 2 more release note checks #13444

Merged
merged 5 commits into from
Oct 14, 2020
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tools/code_format/check_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
PROTO_VALIDATION_STRING = re.compile(r'\bmin_bytes\b')
VERSION_HISTORY_NEW_LINE_REGEX = re.compile("\* ([a-z \-_]+): ([a-z:`]+)")
VERSION_HISTORY_SECTION_NAME = re.compile("^[A-Z][A-Za-z ]*$")
RELOADABLE_FLAG_REGEX = re.compile(".*(.)(envoy.reloadable_features.[^ ]*)\s.*")
RELOADABLE_FLAG_REGEX = re.compile(".*(..)(envoy.reloadable_features.[^ ]*)\s.*")
INVALID_REFLINK = re.compile(".* ref:.*")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the only way the reflink is usually invalid? Or is this a way that sphinx compiles/only warns about?

The reason I am asking is I wonder if we should check for this on formatting or if we should allow the sphinx compiler to complain

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's totally legal.
Prior check mandated that reloadable flags were enclosed in single backticks, but on the latest release Asra caught that two flags out of something like 10 had double backticks, causing formatting inconsistencies by looking different. This is just for visual consistency.

# Check for punctuation in a terminal ref clause, e.g.
# :ref:`panic mode. <arch_overview_load_balancing_panic_threshold>`
REF_WITH_PUNCTUATION_REGEX = re.compile(".*\. <[^<]*>`\s*")
Expand Down Expand Up @@ -447,11 +448,16 @@ def reportError(message):
next_word_to_check = '' # first word after :
prior_line = ''

invalid_reflink_match = INVALID_REFLINK.match(line)
if invalid_reflink_match:
reportError("Found text \" ref:\". This should probably be \" :ref:\"\n%s" % line)

# make sure flags are surrounded by ``s
flag_match = RELOADABLE_FLAG_REGEX.match(line)
if flag_match:
if not flag_match.groups()[0].startswith('`'):
reportError("Flag `%s` should be enclosed in back ticks" % flag_match.groups()[1])
if not flag_match.groups()[0].startswith(' `'):
reportError("Flag `%s` should be enclosed in a single set of back ticks" %
flag_match.groups()[1])

if line.startswith("* "):
if not endsWithPeriod(prior_line):
Expand Down