diff options
| author | Jonas Toth <jonas.toth@gmail.com> | 2018-12-10 19:41:53 +0000 |
|---|---|---|
| committer | Jonas Toth <jonas.toth@gmail.com> | 2018-12-10 19:41:53 +0000 |
| commit | e740145e19b74a98c82d9870b93f9b1c306c20d4 (patch) | |
| tree | 25bf0146f1d21105131312d2cdb6fba260bd7e17 /clang-tools-extra/clang-tidy | |
| parent | c1b2d5905a1c7a27a570567433a6fa22efde3a29 (diff) | |
| download | bcm5719-llvm-e740145e19b74a98c82d9870b93f9b1c306c20d4.tar.gz bcm5719-llvm-e740145e19b74a98c82d9870b93f9b1c306c20d4.zip | |
[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
Diffstat (limited to 'clang-tools-extra/clang-tidy')
| -rwxr-xr-x | clang-tools-extra/clang-tidy/add_new_check.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index eb175b4acd1..f4c518d085f 100755 --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -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 |

