[llvm-bugs] [Bug 42624] New: clang-format badly format .clang-format config file

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 15 07:54:11 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42624

            Bug ID: 42624
           Summary: clang-format badly format .clang-format config file
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yvesg at google.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

To reproduce, create a .clang-format config file:

    BasedOnStyle: Chromium
    ---
    Language: Java
    BasedOnStyle: Google
    ---

Then the following command wrongly put everything on the same line. 
    % clang-format -i .clang-format

This leads to the following error subsequently (when using clang-format on
other files):

    YAML:1:39: error: Unexpected token. Expected Key or Block End
    BasedOnStyle : Chromium-- - Language : Java BasedOnStyle : Google-- -
                                      ^
    Error reading /dummy/.clang-format: Invalid argument

This is likely to happen (and surprising) when formatting a whole code base:
    % git ls-files | xargs clang-format -i

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190715/dd644c3c/attachment.html>


More information about the llvm-bugs mailing list