<div dir="ltr"><div dir="ltr">Hi Jonas:<div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 21, 2019 at 2:07 AM Jonas Toth <<a href="mailto:development@jonas-toth.eu" target="_blank">development@jonas-toth.eu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p>Hey,</p>
<p>your task sounds like a "clang-tidy-diff.py" integration into
git?</p>
<p>-
<a class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-txt-link-freetext" href="https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/tool/clang-tidy-diff.py" target="_blank">https://github.com/llvm-mirror/clang-tools-extra/blob/master/clang-tidy/tool/clang-tidy-diff.py</a><br>
- <a class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-txt-link-freetext" href="https://reviews.llvm.org/D57662" target="_blank">https://reviews.llvm.org/D57662</a> (parallelizing it was done as
well).</p>
<p>Do you think that suits your needs?</p></div></blockquote><div>Thanks for the pointer. It's close, and I like that it runs with any diff, not just git.</div><div><div><br></div><div>However, it has a few issues:</div><div><br></div><div> - doesn't run on headers, even if they are in the diff, unless your .clang-tidy file has "HeaderFilterRegex: '.*'" or something similar</div><div> - missing option to run clang-format over changes lines</div><div> - line filter means that it only runs on the changed lines</div><div><br></div><div>The line filter prevents parallel instances of clang-tidy from changing the same header multiple times, but limits its usefulness.</div><div><br></div><div>My goal is to run the checks over entire files in the change set, so leveraging run-clang-tidy.py seems like a better option. Here's the workflow I had in mind:</div><div><br></div><div> - Create a change set, e.g., via phab</div><div> - commit and push the accepted change, then</div><div> - run the llvm* checks over the files in the change set as a separate commit and push</div><div><br></div><div>Performing the last step in a server side hook, would be optimal.</div><div><br></div></div><div>This may or may not be a workflow that clang/llvm wants, but I still think it's valid.</div><div><br></div><div>thanks again for the pointer...</div><div>don</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
<p>Best Regards,<br>
Jonas<br>
</p>
<div class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-cite-prefix">Am 21.06.19 um 04:31 schrieb Don Hinton
via cfe-dev:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Btw, the motivation for this custom command is to
make it easy to apply a set of clang-tidy checks to just the
files in your change set, and no others.
<div><br>
</div>
<div>Obviously, checks that change symbol names wouldn't be
appropriate for targeted sets like this, so I'm mainly looking
to apply the current llvm* ones to start with. And since it
accepts a checks= argument and respects the .clang-tidy file,
I'm hoping it will be generally useful.</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Thu, Jun 20, 2019 at 6:54
PM Don Hinton <<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">I'd like to drive run-clang-tidy.py from a git
custom command, e.g.:
<div><br>
</div>
<div> $ git clang-tidy <commit> [-fix-errors]
[etc...]</div>
<div><br>
</div>
<div>And pass the all the files in the diff, with headers
going in '-header-filter='. This works great for small
diffs -- I'm using `git diff -name-only` under the hood to
get the list of files -- but large diffs will inevitably
generate extremely long command lines.</div>
<div><br>
</div>
<div>Since clang-tidy can read @response-files, I figure I
could just create my super long command line and pass it
through, which would require a small change to
run-clang-tidy.py. run-clang-tidy.py could then create
individual @respone-files for each clang-tidy instance as
needed -- in case the number of headers is large. To
work, each instance would need the complete list of
headers in the diff.</div>
<div><br>
</div>
<div>But, before I go off and start hacking it up, I just
wanted to see if anyone had a better idea. I guess I'll
have the pass the file name to python as just a regular
option, since the @file notation doesn't seem to be
present, but I'm no python expert.</div>
<div><br>
</div>
<div>Btw, I have a working prototype, loosely based on
git-clang-format, which can call either clang-tidy
directly in a loop, or pass the entire list to
run-clang-tidy.py which can do it in parallel.</div>
<div><br>
</div>
<div>thanks...</div>
<div>don</div>
</div>
</blockquote>
</div>
<br>
<fieldset class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204mimeAttachmentHeader"></fieldset>
<pre class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-quote-pre">_______________________________________________
cfe-dev mailing list
<a class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>
<a class="m_1066362753233313365m_-8263400556266570562gmail-m_18928177744397670gmail-m_-103076121273473204moz-txt-link-freetext" href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
</div>
</blockquote></div>
</div>