Finish clang-tidy cleanups (#3003)

* Add .clang-tidy configuration.
* A separate .clang-tidy is used for hal includes to suppress modernize-use-using
  (as these are C headers).
* Add NOLINT where necessary for a clean run.
* Add clang-tidy job to lint-format workflow.  This workflow is now only run on PRs.
  To reduce runtime, clang-tidy is only run on files changed in the PR.

Two wpilibc changes; both are unlikely to break user code:
* BuiltInAccelerometer: Make SetRange() final
* Counter: Make SetMaxPeriod() final

After these cleanups, the only file that does not run cleanly is
cscore_raw_cv.h due to it not being standalone.
This commit is contained in:
Peter Johnson
2021-01-01 10:27:49 -08:00
committed by GitHub
parent d741101fe3
commit f5e0fc3e9a
49 changed files with 314 additions and 138 deletions

View File

@@ -20,6 +20,7 @@ TEST(ManagedStaticTest, LazyDoesNotInitialize) {
{
refCount = 0;
wpi::ManagedStatic<StaticTestClass> managedStatic;
(void)managedStatic;
ASSERT_EQ(refCount, 0);
}
ASSERT_EQ(refCount, 0);
@@ -43,7 +44,7 @@ TEST(ManagedStaticTest, EagerInit) {
{
refCount = 0;
StaticTestClass* test = new StaticTestClass{};
ASSERT_EQ(refCount, 1);
ASSERT_EQ(refCount, 1); // NOLINT
wpi::ManagedStatic<StaticTestClass> managedStatic(
test, [](void* val) { delete static_cast<StaticTestClass*>(val); });
ASSERT_EQ(refCount, 1);

View File

@@ -11,13 +11,13 @@ namespace wpi::uv {
TEST(UvSimpleBufferPool, ConstructDefault) {
SimpleBufferPool<> pool;
auto buf1 = pool.Allocate();
ASSERT_EQ(buf1.len, 4096u);
ASSERT_EQ(buf1.len, 4096u); // NOLINT
}
TEST(UvSimpleBufferPool, ConstructSize) {
SimpleBufferPool<4> pool{8192};
auto buf1 = pool.Allocate();
ASSERT_EQ(buf1.len, 8192u);
ASSERT_EQ(buf1.len, 8192u); // NOLINT
}
TEST(UvSimpleBufferPool, ReleaseReuse) {