[PATCH] D72421: [clang-tidy] Refresh the add_new_check.py now that we use a table + autofix

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 9 07:43:36 PST 2020


alexfh accepted this revision.
alexfh added a comment.
This revision is now accepted and ready to land.

Awesome! Thanks for updating the script! A few nits, otherwise LG, if this works.



================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:308
+
+    checkerCode = os.path.join(dirname,get_camel_name(check_name)) + ".cpp"
+
----------------
nit: Space after the comma.


================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:316
+      if 'FixItHint' in code or "ReplacementText" in code or "fixit" in code:
+        # Some stupid heuristics to figure out if a checker has an autofix or not
+        return ' "Yes"'
----------------
nit: They are not completely stupid, they are just simple and naive ;)
Also, please add a trailing period.


================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:328
       if match:
-        return ''
+        # Orphan page, don't list it
+        return '', ''
----------------
Trailing period.


================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:350
+      if match.group(1) == 'https://clang.llvm.org/docs/analyzer/checkers':
+        titleRedirect = 'Clang Static Analyzer'
+      else:
----------------
nit: The script uses a_different_naming_style.


================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:353
+        titleRedirect = match.group(1)
+      # The checker is just a redirect
+      return '   `%(check)s <%(check)s.html>`_, `%(title)s <%(target)s.html>`_,%(autofix)s\n' % {
----------------
Trailing period.


================
Comment at: clang-tools-extra/clang-tidy/add_new_check.py:372
+        f.write('   :header: "Name", "Offers fixes"\n')
+        f.write('   :widths: 50, 20\n\n')
         f.writelines(checks)
----------------
Is there a way to let sphinx find out column widths itself?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72421/new/

https://reviews.llvm.org/D72421





More information about the cfe-commits mailing list