[PATCH] D15796: [PATCH] clang-tidy documentation redirects
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 11 07:25:41 PST 2016
alexfh added inline comments.
================
Comment at: docs/clang-tidy/checks/cert-dcl54-cpp.rst:7
@@ +6,3 @@
+==============
+
+The cert-dcl54-cpp checker is an alias, please see
----------------
This seems to do what we need (full file is here {F1298675}):
```
diff --git a/clang-tidy/add_new_check.py b/clang-tidy/add_new_check.py
index 6ecc89d..6000616 100755
--- a/clang-tidy/add_new_check.py
+++ b/clang-tidy/add_new_check.py
@@ -215,15 +215,25 @@ void awesome_f2();
# Recreates the list of checks in the docs/clang-tidy/checks directory.
def update_checks_list(module_path):
- filename = os.path.normpath(
- os.path.join(module_path, '../../docs/clang-tidy/checks/list.rst'))
+ docs_dir = os.path.join(module_path, '../../docs/clang-tidy/checks')
+ filename = os.path.normpath(os.path.join(docs_dir, 'list.rst'))
with open(filename, 'r') as f:
lines = f.readlines()
-
- checks = map(lambda s: ' ' + s.replace('.rst', '\n'),
- filter(lambda s: s.endswith('.rst') and s != 'list.rst',
- os.listdir(os.path.join(module_path, '../../docs/clang-tidy/checks'))))
- checks.sort()
+ doc_files = filter(
+ lambda s: s.endswith('.rst') and s != 'list.rst',
+ os.listdir(docs_dir))
+ doc_files.sort()
+
+ def format_link(doc_file):
+ check_name = doc_file.replace('.rst', '')
+ with open(os.path.join(docs_dir, doc_file), 'r') as doc:
+ match = re.search('.*:http-equiv=refresh: \d+;URL=(.*).html.*', doc.read())
+ if match:
+ return ' %(check)s (redirects to %(target)s) <%(check)s>\n' % {
+ 'check' : check_name, 'target' : match.group(1) }
+ return ' %s\n' % check_name
+
+ checks = map(format_link, doc_files)
print('Updating %s...' % filename)
with open(filename, 'wb') as f:
```
Can you include this in the patch?
http://reviews.llvm.org/D15796
More information about the cfe-commits
mailing list