<h3>Contribution description</h3>
<p>This PR adds a make target to run clang-tidy. By default the considered source files will those that have been changed regarding to <code>BASE_BRANCH</code> set to master by default.</p>
<h3>Testing procedure</h3>
<p>On a branch different than master run <code>TOOLCHAIN=llvm make -C tests/event_timeout_ztimer/ clang-tidy</code></p>
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="BASE_BRANCH=upstream/master TOOLCHAIN=llvm make -C tests/event_timeout_ztimer/ clang-tidy
64 warnings generated.
127 warnings generated.
192 warnings generated.
328 warnings generated.
404 warnings generated.
/home/francisco/workspace/RIOT/sys/event/periodic_timeout.c:9:1: warning: #includes are not sorted properly [llvm-include-order]
#include "kernel_defines.h"
^        ~~~~~~~~~~~~~~~~~~
         "event/timeout.h"
/home/francisco/workspace/RIOT/sys/include/event/timeout.h:157:20: warning: unused function 'event_periodic_timeout_start' [clang-diagnostic-unused-function]
static inline void event_periodic_timeout_start(event_periodic_timeout_t *event_timeout,
                   ^
/home/francisco/workspace/RIOT/sys/include/event/timeout.h:174:20: warning: unused function 'event_periodic_timeout_stop' [clang-diagnostic-unused-function]
static inline void event_periodic_timeout_stop(event_periodic_timeout_t *event_timeout)
                   ^
/home/francisco/workspace/RIOT/tests/event_timeout_ztimer/main.c:26:1: warning: #includes are not sorted properly [llvm-include-order]
#include "test_utils/expect.h"
^        ~~~~~~~~~~~~~~~~~~~~~
         "event.h"
/home/francisco/workspace/RIOT/tests/events/main.c:25:1: warning: #includes are not sorted properly [llvm-include-order]
#include "test_utils/expect.h"
^        ~~~~~~~~~~~~~~~~~~~~~
         "event.h"
/home/francisco/workspace/RIOT/tests/events/main.c:201:48: warning: 500 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
    event_timeout_set(&event_timeout_canceled, 500 * US_PER_MS);
                                               ^
/home/francisco/workspace/RIOT/tests/events/main.c:201:48: warning: 500 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
Suppressed 397 warnings (397 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
"><pre><code>BASE_BRANCH=upstream/master TOOLCHAIN=llvm make -C tests/event_timeout_ztimer/ clang-tidy
64 warnings generated.
127 warnings generated.
192 warnings generated.
328 warnings generated.
404 warnings generated.
/home/francisco/workspace/RIOT/sys/event/periodic_timeout.c:9:1: warning: #includes are not sorted properly [llvm-include-order]
#include "kernel_defines.h"
^        ~~~~~~~~~~~~~~~~~~
         "event/timeout.h"
/home/francisco/workspace/RIOT/sys/include/event/timeout.h:157:20: warning: unused function 'event_periodic_timeout_start' [clang-diagnostic-unused-function]
static inline void event_periodic_timeout_start(event_periodic_timeout_t *event_timeout,
                   ^
/home/francisco/workspace/RIOT/sys/include/event/timeout.h:174:20: warning: unused function 'event_periodic_timeout_stop' [clang-diagnostic-unused-function]
static inline void event_periodic_timeout_stop(event_periodic_timeout_t *event_timeout)
                   ^
/home/francisco/workspace/RIOT/tests/event_timeout_ztimer/main.c:26:1: warning: #includes are not sorted properly [llvm-include-order]
#include "test_utils/expect.h"
^        ~~~~~~~~~~~~~~~~~~~~~
         "event.h"
/home/francisco/workspace/RIOT/tests/events/main.c:25:1: warning: #includes are not sorted properly [llvm-include-order]
#include "test_utils/expect.h"
^        ~~~~~~~~~~~~~~~~~~~~~
         "event.h"
/home/francisco/workspace/RIOT/tests/events/main.c:201:48: warning: 500 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers]
    event_timeout_set(&event_timeout_canceled, 500 * US_PER_MS);
                                               ^
/home/francisco/workspace/RIOT/tests/events/main.c:201:48: warning: 500 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
Suppressed 397 warnings (397 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
</code></pre></div>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/RIOT-OS/RIOT/pull/16509'>https://github.com/RIOT-OS/RIOT/pull/16509</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>makefiles/clang-tidy: initial support</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16509/files#diff-3c8fb3a3507e1db4ca93b4d7b28883c763dc084a2ca0dc45adc907d9e4abedef">Makefile.include</a>
    (2)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/RIOT-OS/RIOT/pull/16509/files#diff-b477a9810444e180ba06af282c3715161db328dc8667e3f4417019d464233b47">makefiles/clang_tidy.inc.mk</a>
    (18)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16509.patch'>https://github.com/RIOT-OS/RIOT/pull/16509.patch</a></li>
  <li><a href='https://github.com/RIOT-OS/RIOT/pull/16509.diff'>https://github.com/RIOT-OS/RIOT/pull/16509.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/16509">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYFQ3NJMX4HRSRUUQTLTP5SUJANCNFSM45WHOEFA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYGMFJHIREWEN4RH4F3TP5SUJA5CNFSM45WHOEFKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NPSSC3A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/16509",
"url": "https://github.com/RIOT-OS/RIOT/pull/16509",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>