[PATCH] D18509: clang-tidy: add_new_check.py stubs out release notes

Richard via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 27 22:16:35 PDT 2016


LegalizeAdulthood created this revision.
LegalizeAdulthood added a reviewer: alexfh.
LegalizeAdulthood added a subscriber: cfe-commits.

Update `add_new_check.py` to stub out information in the release notes for the new check.

http://reviews.llvm.org/D18509

Files:
  clang-tidy/add_new_check.py

Index: clang-tidy/add_new_check.py
===================================================================
--- clang-tidy/add_new_check.py
+++ clang-tidy/add_new_check.py
@@ -261,6 +261,38 @@
 """ % {"check_name_dashes" : check_name_dashes,
        "underline" : "=" * len(check_name_dashes)})
 
+
+# Adds the new check to the release notes for clang-tidy
+def adapt_release_notes(module_path, module, check_name):
+  check_name_dashes = module + '-' + check_name
+  filename = os.path.normpath(
+    os.path.join(module_path, '../../docs/ReleaseNotes.rst'))
+  print('Updating %s...' % filename)
+  with open(filename, 'r') as release_notes:
+    lines = release_notes.readlines()
+  with open(filename, 'w') as release_notes:
+    clang_tidy_found = False
+    clang_tidy_heading_found = False
+    bullet_found = False
+
+    for line in lines:
+      if not clang_tidy_found:
+        if line.startswith("Improvements to ``clang-tidy``"):
+          clang_tidy_found = True
+      elif not clang_tidy_heading_found:
+        if line.startswith('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'):
+          clang_tidy_heading_found = True
+      elif not bullet_found:
+        if line.startswith('- '):
+          bullet_found = True
+          release_notes.write('- New ``' + check_name_dashes + '`` check\n')
+          release_notes.write('\n')
+          release_notes.write('  FIXME: summarize the check\n')
+          release_notes.write('\n')
+      release_notes.write(line)
+  pass
+
+
 def main():
   if len(sys.argv) == 2 and sys.argv[1] == '--update-docs':
     update_checks_list(os.path.dirname(sys.argv[0]))
@@ -289,6 +321,7 @@
   adapt_module(module_path, module, check_name, check_name_camel)
   write_test(module_path, module, check_name)
   write_docs(module_path, module, check_name)
+  adapt_release_notes(module_path, module, check_name)
   update_checks_list(clang_tidy_path)
   print('Done. Now it\'s your turn!')
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18509.51771.patch
Type: text/x-patch
Size: 1925 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160328/6b593f6d/attachment.bin>


More information about the cfe-commits mailing list