merge_guards_bot reports clang-tidy/clang-format findings unrelated to modified code

First, I love this bot:) It makes LLVM's "pushing to master" practise less awful:)
Now the main topic...

clang-tidy: fail. Please fix clang-tidy findings.

For example, on ⚙ D72103 [Sema] Avoid using an invalid InsertPos ,
merge_guards_bot reports clang-tidy findings of existing code, not just
the modified code.

I think should use
--line-filter= as clang-tidy/tool/ does.

clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch.

Similarly, clang-format should use --lines to filter out untouched code.

I second Fangrui's findings and add:

- clang-format should only run on "source" files. For one, it runs on
  non-C/C++ files right now with the results you can imagine. Even if it
  is a C/C++ test we do not always want to format it.
- it would be perfect if the linter would not report issues that are
  present in the surrounding code, e.g., if the naming scheme is kept
  consistent with the surrounding code it should not report it as
  problematic. For example, since the functions in ADT/SetOperations.h
  are all flagged as problematic which means if you add one in the same
  style it is flagged as well.

I already file a bug report to request not to format the tests [1].


Kind regards,
Mark de Wever

+Mikhail Goncharov

Hi Fangrui,

I’m glad you like the tool!

We got a bunch of issues reported around clang-tidy, so Mikhail disabled it today. Since the thread has a few other points, I created a separate issue [1] for it.

The linter script [2] is already using clang-tidy-diff on the git diff. So it should only look into changed lines…