Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
26c06cb
Fix clang-tidy and sanitizer CI config blocking time_daemon checks
MaciejSalwa543 Oct 16, 2026
88053bb
Restore explicit base init in TimeDaemon ctor
MaciejSalwa543 Oct 16, 2026
5c660a3
Fix MISRA findings in receiver factory and kGptpIpcName
MaciejSalwa543 Oct 16, 2026
9a771e1
Drop misleading comments in time_daemon machines
MaciejSalwa543 Oct 16, 2026
60de8bd
Move optional guard to top and fix coverage justification lines
MaciejSalwa543 Oct 16, 2026
628a80e
Allow all-public structs in non-private-member-variables check
MaciejSalwa543 Oct 16, 2026
a1feac5
Restore constructor init lists in time_daemon
MaciejSalwa543 Oct 16, 2026
c0d3741
Fix clang-tidy findings in timebase handler code
MaciejSalwa543 Nov 13, 2026
5d01615
Fix stale coverage justification lines
MaciejSalwa543 Nov 15, 2026
2f8939b
Concatenate nested namespaces in score/time
MaciejSalwa543 Oct 19, 2026
3cea627
Add missing includes in score/time
MaciejSalwa543 Oct 19, 2026
7095f19
Fix small clang-tidy findings in vehicle_time and benchmark
MaciejSalwa543 Oct 23, 2026
7f1c886
Delete copy and move in clock backend interfaces
MaciejSalwa543 Nov 2, 2026
768e56c
Add nodiscard to clock backends and vehicle time status
MaciejSalwa543 Nov 12, 2026
dea5bb8
Rename short identifiers in score/time
MaciejSalwa543 Nov 12, 2026
c7ce2e4
Suppress remaining clang-tidy findings in score/time
MaciejSalwa543 Nov 12, 2026
79021f2
Avoid optional::value() in noexcept vehicle_time functions
MaciejSalwa543 Nov 12, 2026
cd23f3a
Tighten clang-tidy gate: score/time at zero, other at 900
MaciejSalwa543 Nov 12, 2026
dae39a7
Use concatenated namespaces in score/time tests, mocks and headers
MaciejSalwa543 Nov 15, 2026
b0265ec
Default SvtCallbackDispatcher destructor
MaciejSalwa543 Nov 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ build:asan_ubsan_lsan --config=with_debug_symbols
build:asan_ubsan_lsan --copt=-fsanitize=undefined,address,leak
build:asan_ubsan_lsan --linkopt=-fsanitize=undefined,address,leak
build:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan
build:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:sanitizer=asan_ubsan_lsan
# score_cpp_policies removed the combined string flag ":sanitizer" in favor of
# per-sanitizer bool flags; the //sanitizers:wrapper run_under target (and its
# constraints/features) only activate when these are set, otherwise every test
# using it is marked incompatible and silently skipped.
build:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:asan=True
build:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:ubsan=True
build:asan_ubsan_lsan --@score_cpp_policies//sanitizers/flags:lsan=True
test:asan_ubsan_lsan --run_under=@score_cpp_policies//sanitizers:wrapper
test:asan_ubsan_lsan --test_tag_filters=-no-asan,-no-lsan,-no-ubsan
test:asan_ubsan_lsan --build_tests_only
Expand Down
34 changes: 34 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# Default clang-tidy configuration for S-CORE C++ modules.
# NOTE: the set of enabled checks is yet subject to be tailored per module.
Checks: "-*,clang-analyzer-*,cert-*,cppcoreguidelines-*,bugprone-*,misc-*,performance-*,readability-*,modernize-*,-modernize-use-trailing-return-type,-readability-redundant-member-init,-modernize-use-default-member-init,-cppcoreguidelines-use-default-member-init"

# NOTE: WarningsAsErrors is yet subject to be expanded per module as compliance increases.
WarningsAsErrors: "clang-analyzer-*"

# HeaderFilterRegex is intentionally absent from the central baseline.
# Each consuming module must set this in their local .clang-tidy to match
# their own source tree (e.g., HeaderFilterRegex: 'score/mw/').
# Setting it here would either suppress all header analysis (empty string)
# or generate noise from external dependency headers (broad regex).
# LLVM's regex engine does not reliably support POSIX lookaheads, so
# negative-lookahead patterns like (?!.*/external/) must not be used here.

FormatStyle: none

# NOTE: CheckOptions are yet subject to be provided for each enabled check per module.
CheckOptions:
misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: true
cppcoreguidelines-rvalue-reference-param-not-moved.IgnoreUnnamedParams: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added for the 3 unnamed && params in the vehicle_time stub (SetTimeSlaveSyncDataReceivedCallback etc.), the stub ignores the callback on purpose. An unnamed param can't be moved anyway, so this can't hide a real missed move. I'd keep it as an option instead of 3 NOLINTs, even though it applies repo-wide

31 changes: 25 additions & 6 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,34 @@ jobs:
| xargs cat 2>/dev/null > clang_tidy_findings.txt || true

- name: Check violation baseline
# Baseline recorded on 2026-07-03. Decrease when violations are fixed.
# Remove this step once https://github.com/eclipse-score/time/issues/111 is resolved.
if: always()
run: |
BASELINE=85
COUNT=$(wc -l < clang_tidy_findings.txt 2>/dev/null || echo 0)
echo "Clang-tidy violations: $COUNT (baseline: $BASELINE)"
if [ "$COUNT" -gt "$BASELINE" ]; then
echo "::error::Clang-tidy violations grew: $COUNT > baseline $BASELINE. Fix new violations before merging."
TIME_DAEMON_BASELINE=0
TIME_DAEMON_COUNT=$(grep -cE "score/time_daemon/[^:]*:[0-9]+:[0-9]+: (warning|error):" clang_tidy_findings.txt 2>/dev/null || true)
TIME_DAEMON_COUNT=${TIME_DAEMON_COUNT:-0}
echo "Clang-tidy violations in score/time_daemon/: $TIME_DAEMON_COUNT (baseline: $TIME_DAEMON_BASELINE)"

TIME_BASELINE=0
TIME_COUNT=$(grep -cE "score/time/[^:]*:[0-9]+:[0-9]+: (warning|error):" clang_tidy_findings.txt 2>/dev/null || true)
TIME_COUNT=${TIME_COUNT:-0}
echo "Clang-tidy violations in score/time/: $TIME_COUNT (baseline: $TIME_BASELINE)"

OTHER_BASELINE=900
OTHER_COUNT=$(grep -E ":[0-9]+:[0-9]+: (warning|error):" clang_tidy_findings.txt 2>/dev/null | grep -vcE "score/time_daemon/" || true)
OTHER_COUNT=${OTHER_COUNT:-0}
echo "Clang-tidy violations outside score/time_daemon/: $OTHER_COUNT (baseline: $OTHER_BASELINE)"

if [ "$TIME_DAEMON_COUNT" -gt "$TIME_DAEMON_BASELINE" ]; then
echo "::error::Clang-tidy violations in score/time_daemon/ grew: $TIME_DAEMON_COUNT > baseline $TIME_DAEMON_BASELINE. Fix new violations before merging."
exit 1
fi
if [ "$TIME_COUNT" -gt "$TIME_BASELINE" ]; then
echo "::error::Clang-tidy violations in score/time/ grew: $TIME_COUNT > baseline $TIME_BASELINE. Fix new violations before merging."
exit 1
fi
if [ "$OTHER_COUNT" -gt "$OTHER_BASELINE" ]; then
echo "::error::Clang-tidy violations outside score/time_daemon/ grew: $OTHER_COUNT > baseline $OTHER_BASELINE. Fix new violations before merging."
exit 1
fi

Expand Down
2 changes: 2 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ exports_files(
[
# Used by the @score_tooling coverage reporter to locate the workspace root.
"MODULE.bazel",
# Referenced by //tools/lint:linters.bzl as a local_configs entry for the clang-tidy aspect.
".clang-tidy",
],
)

Expand Down
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ llvm = use_extension(
)
llvm.toolchain(
llvm_version = "19.1.7",
stdlib = {"": "stdc++"},
)

# Coverage-only Clang instance (covmap instrumentation for the LLVM coverage
Expand Down
7 changes: 2 additions & 5 deletions score/time/clock/src/availability_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

#include <type_traits>

namespace score
{
namespace time
namespace score::time
{

/// @brief SFINAE gate for @c Clock<Tag>::IsAvailable() and @c WaitUntilAvailable().
Expand Down Expand Up @@ -54,7 +52,6 @@ struct HasAvailability<Tag, std::void_t<decltype(&AvailabilityHook<Tag>::CallIsA
{
};

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_AVAILABILITY_HOOK_H
7 changes: 2 additions & 5 deletions score/time/clock/src/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
#include <memory>
#include <mutex>

namespace score
{
namespace time
namespace score::time
{

// Forward declarations for test-only helpers. Placed in their own sub-namespace
Expand Down Expand Up @@ -226,7 +224,6 @@ class Clock
inline static std::shared_ptr<Backend> instance_override_{};
};

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_CLOCK_H
7 changes: 2 additions & 5 deletions score/time/clock/src/clock_snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@

#include <chrono>

namespace score
{
namespace time
namespace score::time
{

/// @brief Immutable snapshot of a clock reading at one instant, bundled with its quality metadata.
Expand Down Expand Up @@ -77,7 +75,6 @@ class ClockSnapshot
StatusT status_{};
};

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_CLOCK_SNAPSHOT_H
9 changes: 3 additions & 6 deletions score/time/clock/src/clock_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

#include <score/assert.hpp>

namespace score
{
namespace time
namespace score::time
{

/// @brief Encapsulates the synchronisation-quality status of a timebase as a set of bit flags.
Expand Down Expand Up @@ -115,7 +113,7 @@ class ClockStatus final
///
/// @note Coverage of this method lives in the domain-level test (e.g.
/// @c vehicle_time_status_test.cpp), not in this file.
std::ostringstream PrintTo() const;
[[nodiscard]] std::ostringstream PrintTo() const;

/// @brief Adds a flag bit-position to this status.
///
Expand Down Expand Up @@ -170,7 +168,6 @@ auto operator<<(OutputStream& output_stream, const ClockStatus<FlagEnumT, Storag
return output_stream;
}

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_CLOCK_STATUS_H
7 changes: 2 additions & 5 deletions score/time/clock/src/clock_status_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
#include <cstdint>
#include <limits>

namespace score
{
namespace time
namespace score::time
{

class TestClockStatus : public ::testing::Test
Expand Down Expand Up @@ -184,5 +182,4 @@ TEST_F(TestClockStatus, InitializerListConstructorWithZeroFlagsMatchesDefault)
{StatusFlag::kTimeOut, StatusFlag::kSynchronized, StatusFlag::kSynchToGateway, StatusFlag::kUnknown}));
}

} // namespace time
} // namespace score
} // namespace score::time
10 changes: 2 additions & 8 deletions score/time/clock/src/clock_test_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

#include <memory>

namespace score
{
namespace time
{
namespace test_utils
namespace score::time::test_utils
{

/// @brief Test-only factory — constructs a @c Clock<Tag> wrapping an explicit backend.
Expand Down Expand Up @@ -60,8 +56,6 @@ class ClockTestFactory
ClockTestFactory& operator=(ClockTestFactory&&) = delete;
};

} // namespace test_utils
} // namespace time
} // namespace score
} // namespace score::time::test_utils

#endif // SCORE_TIME_CLOCK_SRC_CLOCK_TEST_FACTORY_H
7 changes: 2 additions & 5 deletions score/time/clock/src/clock_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#ifndef SCORE_TIME_CLOCK_SRC_CLOCK_TRAITS_H
#define SCORE_TIME_CLOCK_SRC_CLOCK_TRAITS_H

namespace score
{
namespace time
namespace score::time
{

/// @brief Type and behaviour traits for a clock domain.
Expand All @@ -36,7 +34,6 @@ namespace time
template <typename Tag>
struct ClockTraits;

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_CLOCK_TRAITS_H
7 changes: 2 additions & 5 deletions score/time/clock/src/initialization_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

#include <type_traits>

namespace score
{
namespace time
namespace score::time
{

/// @brief SFINAE gate for @c Clock<Tag>::Init().
Expand Down Expand Up @@ -54,7 +52,6 @@ struct HasInitialization<Tag, std::void_t<decltype(&InitializationHook<Tag>::Cal
{
};

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_INITIALIZATION_HOOK_H
7 changes: 2 additions & 5 deletions score/time/clock/src/no_status.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#ifndef SCORE_TIME_CLOCK_SRC_NO_STATUS_H
#define SCORE_TIME_CLOCK_SRC_NO_STATUS_H

namespace score
{
namespace time
namespace score::time
{

/// @brief Empty placeholder status type for clocks that have no quality concept
Expand All @@ -28,7 +26,6 @@ struct NoStatus
{
};

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_NO_STATUS_H
10 changes: 2 additions & 8 deletions score/time/clock/src/scoped_clock_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@

#include <memory>

namespace score
{
namespace time
{
namespace test_utils
namespace score::time::test_utils
{

/// @brief RAII guard that installs a test-double backend for @c Clock<Tag>.
Expand Down Expand Up @@ -77,8 +73,6 @@ class ScopedClockOverride final
bool active_;
};

} // namespace test_utils
} // namespace time
} // namespace score
} // namespace score::time::test_utils

#endif // SCORE_TIME_CLOCK_SRC_SCOPED_CLOCK_OVERRIDE_H
7 changes: 2 additions & 5 deletions score/time/clock/src/subscription_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
#ifndef SCORE_TIME_CLOCK_SRC_SUBSCRIPTION_HOOK_H
#define SCORE_TIME_CLOCK_SRC_SUBSCRIPTION_HOOK_H

namespace score
{
namespace time
namespace score::time
{

/// @brief SFINAE gate for @c Clock<Tag>::Subscribe<EventType>() and @c Unsubscribe<EventType>().
Expand All @@ -34,7 +32,6 @@ namespace time
template <typename Tag, typename EventType>
struct SubscriptionHook;

} // namespace time
} // namespace score
} // namespace score::time

#endif // SCORE_TIME_CLOCK_SRC_SUBSCRIPTION_HOOK_H
13 changes: 2 additions & 11 deletions score/time/high_res_steady_time/src/details/qtime/factory_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@

#include <gtest/gtest.h>

namespace score
{
namespace time
{
namespace high_res_steady_time
{
namespace qtime
namespace score::time::high_res_steady_time::qtime
{
namespace
{
Expand Down Expand Up @@ -51,7 +45,4 @@ TEST(HighResSteadyQClockFactoryTest, CreateBackendReturnsHighResSteadyQClock)
}

} // namespace
} // namespace qtime
} // namespace high_res_steady_time
} // namespace time
} // namespace score
} // namespace score::time::high_res_steady_time::qtime
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,9 @@
#include <chrono>
#include <memory>

namespace score
namespace score::time
{
namespace time
{
namespace high_res_steady_time
{
namespace qtime
namespace high_res_steady_time::qtime
{

ClockSnapshot<HighResSteadyTime::Timepoint, NoStatus> HighResSteadyQClock::Now() const noexcept
Expand Down Expand Up @@ -57,8 +53,7 @@ std::chrono::nanoseconds HighResSteadyQClock::ClockCyclesToNanoseconds(const std
return converted;
}

} // namespace qtime
} // namespace high_res_steady_time
} // namespace high_res_steady_time::qtime

// req-Id: comp_req__time__supported_platforms
template <>
Expand All @@ -67,5 +62,4 @@ std::shared_ptr<HighResSteadyClockBackend> detail::CreateBackend<HighResSteadyTi
return std::make_shared<high_res_steady_time::qtime::HighResSteadyQClock>();
}

} // namespace time
} // namespace score
} // namespace score::time
Loading
Loading