[PATCH] D112572: [docs][clang-format] warn on code indentation error

Ludovic Jozeau via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 26 13:25:34 PDT 2021


FederAndInk created this revision.
FederAndInk added reviewers: MyDeveloperDay, HazardyKnusperkeks.
FederAndInk requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There is an indentation issue in Format.h causing the html to not render correctly
It's a `\code` block in the documentation of SpacesInLineComment

So I fixed it, and added some warnings in clang/docs/tools/dump_format_style.py:

- fix intentation of `SpacesInLineComment`
- warn on indentation error
- also warn on `\code` `\endcode` mismatch
- generate precise warnings

here is a look at the generated warnings:

  > ./dump_format_style.py
  ../../include/clang/Format/Format.h:3448: warning: code block should be indented:
    3448 | /// before:                                   after:
    3449 | /// Minimum: 1
    3450 | /// //if (b) {                                // if (b) {
    3451 | /// //  return true;                          //   return true;
    3452 | /// //}                                       // }
  ../../include/clang/Format/Format.h:3454: warning: code block should be indented:
    3454 | /// Maximum: 0
    3455 | /// /// List:                                 ///List:
    3456 | /// ///  - Foo                                /// - Foo
    3457 | /// ///    - Bar                              ///   - Bar


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D112572

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/tools/dump_format_style.py
  clang/include/clang/Format/Format.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112572.382447.patch
Type: text/x-patch
Size: 17620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211026/58cc8755/attachment-0001.bin>


More information about the cfe-commits mailing list