Page MenuHomePhabricator

[clang-tidy] Format code around applied fixes
ClosedPublic

Authored by alexfh on Mar 3 2017, 1:22 AM.

Details

Event Timeline

alexfh created this revision.Mar 3 2017, 1:22 AM
malcolm.parsons added inline comments.
test/clang-tidy/readability-braces-around-statements-format.cpp
2

Will clang-tidy look for a .clang-format file?
Does this test rely on a .clang-format file being found / not found?

alexfh updated this revision to Diff 90442.Mar 3 2017, 1:44 AM

Pacify llvm::Expected<> debug checks.

alexfh added inline comments.Mar 3 2017, 1:46 AM
test/clang-tidy/readability-braces-around-statements-format.cpp
2

Good question. No idea ;) Lemme check...

kimgr added a subscriber: kimgr.Mar 3 2017, 1:46 AM
kimgr added inline comments.
docs/clang-tidy/index.rst
191

This looks like a separate patch?

alexfh marked an inline comment as done.Mar 3 2017, 1:53 AM
alexfh added inline comments.
docs/clang-tidy/index.rst
191

I've just pasted up-to-date -help output here. This should have been done when the -quiet option was added.

ioeric added inline comments.Mar 3 2017, 2:25 AM
test/clang-tidy/readability-braces-around-statements-format.cpp
2

Yes, it will look for .clang-format file in the working directory and its parents. If there happens to be a .clang-format with different style, the test might fail. We might want to explicitly set the style or add a .clang-format file in the test directory.

alexfh updated this revision to Diff 90445.Mar 3 2017, 2:26 AM
alexfh marked an inline comment as done.

Replace the separate -format and -style options with -format-style (default is
'none', which means no formatting).

alexfh marked 2 inline comments as done.Mar 3 2017, 2:27 AM
alexfh marked 2 inline comments as done.

Replace the separate -format and -style options with -format-style (default is
'none', which means no formatting).

Is there a style that means use my .clang-format file?

alexfh updated this revision to Diff 90447.Mar 3 2017, 3:06 AM

Expanded -format-style option description. Run cleanup tests with different format styles, just in case.

alexfh added a comment.Mar 3 2017, 3:07 AM

Replace the separate -format and -style options with -format-style (default is
'none', which means no formatting).

Is there a style that means use my .clang-format file?

Yes, -format-style=file, see the updated docs.

alexfh updated this revision to Diff 90448.Mar 3 2017, 3:11 AM

Clarify the 'file' option a bit.

This revision is now accepted and ready to land.Mar 3 2017, 3:14 AM
ioeric added inline comments.Mar 3 2017, 3:17 AM
clang-tidy/ClangTidy.cpp
214

Maybe still apply the replacements if formatting fails?

alexfh updated this revision to Diff 90452.Mar 3 2017, 3:24 AM

Apply changes even when formatting fails.

This revision was automatically updated to reflect the committed changes.