[riot-notifications] [RIOT-OS/RIOT] makefiles/clang-tidy: initial support (#16509)

Francisco notifications at github.com
Fri May 28 12:00:36 CEST 2021


### Contribution description

This PR adds a make target to run clang-tidy. By default the considered source files will those that have been changed regarding to `BASE_BRANCH` set to master by default.

### Testing procedure

On a branch different than master run `TOOLCHAIN=llvm make -C tests/event_timeout_ztimer/ clang-tidy`

```
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.
```

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16509

-- Commit Summary --

  * makefiles/clang-tidy: initial support

-- File Changes --

    M Makefile.include (2)
    A makefiles/clang_tidy.inc.mk (18)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16509.patch
https://github.com/RIOT-OS/RIOT/pull/16509.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16509
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210528/c3493ea7/attachment.htm>


More information about the notifications mailing list