forked from OSchip/llvm-project
[clang-tidy] insert release notes for new checkers alphabetically
Summary: Almost all code review comments on new checkers {D55433} {D48866} {D54349} seem to ask for the release notes to be added alphabetically, plus I've seen commits by @Eugene.Zelenko reordering the lists Make add_new_check.py add those release notes alphabetically based on checker name If include-fixer section is seen add it at the end Minor change in the message format to prevent double newlines added before the checker. Do the tools themselves have unit tests? (sorry new to this game) - Tested adding new checker at the beginning - Tested on adding new checker in the middle - Tested on empty ReleasesNotes.rst (as we would see after RC) Patch by MyDeveloperDay. Reviewers: alexfh, JonasToth, curdeius, aaron.ballman, benhamilton, hokein Reviewed By: JonasToth Subscribers: cfe-commits, xazax.hun, Eugene.Zelenko Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D55508 llvm-svn: 348793
This commit is contained in:
parent
c1b2d5905a
commit
e740145e19
|
@ -200,23 +200,47 @@ def add_release_notes(module_path, module, check_name):
|
|||
with open(filename, 'r') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
lineMatcher = re.compile('Improvements to clang-tidy')
|
||||
nextSectionMatcher = re.compile('Improvements to include-fixer')
|
||||
checkerMatcher = re.compile('- New :doc:`(.*)')
|
||||
|
||||
print('Updating %s...' % filename)
|
||||
with open(filename, 'w') as f:
|
||||
note_added = False
|
||||
header_found = False
|
||||
next_header_found = False
|
||||
add_note_here = False
|
||||
|
||||
for line in lines:
|
||||
if not note_added:
|
||||
match = re.search('Improvements to clang-tidy', line)
|
||||
match = lineMatcher.match(line)
|
||||
match_next = nextSectionMatcher.match(line)
|
||||
match_checker = checkerMatcher.match(line)
|
||||
if match_checker:
|
||||
last_checker = match_checker.group(1)
|
||||
if last_checker > check_name_dashes:
|
||||
add_note_here = True
|
||||
|
||||
if match_next:
|
||||
next_header_found = True
|
||||
add_note_here = True
|
||||
|
||||
if match:
|
||||
header_found = True
|
||||
elif header_found:
|
||||
f.write(line)
|
||||
continue
|
||||
|
||||
if line.startswith('----'):
|
||||
f.write(line)
|
||||
continue
|
||||
|
||||
if header_found and add_note_here:
|
||||
if not line.startswith('----'):
|
||||
f.write("""
|
||||
- New :doc:`%s
|
||||
f.write("""- New :doc:`%s
|
||||
<clang-tidy/checks/%s>` check.
|
||||
|
||||
FIXME: add release notes.
|
||||
|
||||
""" % (check_name_dashes, check_name_dashes))
|
||||
note_added = True
|
||||
|
||||
|
|
Loading…
Reference in New Issue