Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
# Workflow files stored in the
# default location of `.github/workflows`
directory: "/"
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
jobs:
pre-commit:
name: pre-commit
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- name: Install clang-format-14
run: sudo apt-get install clang-format-14
- name: Install clang-format
run: sudo apt-get install clang-format
- uses: pre-commit/[email protected]
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
# Standard hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-byte-order-marker
- id: fix-byte-order-marker
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
Expand All @@ -33,14 +33,14 @@ repos:
hooks:
- id: clang-format
name: clang-format
description: Format files with ClangFormat 14.
entry: clang-format-14
description: Format files with ClangFormat.
entry: clang-format
language: system
files: \.(c|cc|cxx|cpp|frag|glsl|h|hpp|hxx|ih|ispc|ipp|java|js|m|proto|vert)$
args: ['-fallback-style=none', '-i']

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: ['--write-changes', '--ignore-words=.codespell_words']
Expand Down
8 changes: 4 additions & 4 deletions include/rsl/monad.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ namespace rsl {
* @return Return type of fn
*/
template <typename T, typename Fn>
[[nodiscard]] constexpr auto mbind(std::optional<T> const& opt, Fn fn)
-> std::invoke_result_t<Fn, T> {
[[nodiscard]] constexpr auto mbind(std::optional<T> const& opt,
Fn fn) -> std::invoke_result_t<Fn, T> {
static_assert(std::is_convertible_v<std::nullopt_t, std::invoke_result_t<Fn, T>>,
"Fn must return a std::optional");
if (opt) return fn(opt.value());
Expand All @@ -41,8 +41,8 @@ template <typename T, typename Fn>
* @return Return type of the function
*/
template <typename T, typename E, typename Fn>
[[nodiscard]] constexpr auto mbind(tl::expected<T, E> const& exp, Fn fn)
-> std::invoke_result_t<Fn, T> {
[[nodiscard]] constexpr auto mbind(tl::expected<T, E> const& exp,
Fn fn) -> std::invoke_result_t<Fn, T> {
if (exp) return fn(exp.value());
return tl::unexpected(exp.error());
}
Expand Down
24 changes: 12 additions & 12 deletions include/rsl/parameter_validators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ namespace rsl {
namespace detail {
template <typename T, typename Fn>
[[nodiscard]] auto size_compare(rclcpp::Parameter const& parameter, size_t const size,
std::string const& predicate_description, Fn const& predicate)
-> tl::expected<void, std::string> {
std::string const& predicate_description,
Fn const& predicate) -> tl::expected<void, std::string> {
static constexpr auto format_string = "Length of parameter '{}' is '{}' but must be {} '{}'";
switch (parameter.get_type()) {
case rclcpp::ParameterType::PARAMETER_STRING:
Expand All @@ -40,8 +40,8 @@ template <typename T, typename Fn>

template <typename T, typename Fn>
[[nodiscard]] auto compare(rclcpp::Parameter const& parameter, T const& value,
std::string const& predicate_description, Fn const& predicate)
-> tl::expected<void, std::string> {
std::string const& predicate_description,
Fn const& predicate) -> tl::expected<void, std::string> {
if (auto const param_value = parameter.get_value<T>(); !predicate(param_value, value))
return tl::unexpected(fmt::format("Parameter '{}' with the value '{}' must be {} '{}'",
parameter.get_name(), param_value, predicate_description,
Expand Down Expand Up @@ -166,8 +166,8 @@ template <typename T>
* @return Help string if the parameter is invalid, otherwise void
*/
template <typename T>
[[nodiscard]] auto lower_element_bounds(rclcpp::Parameter const& parameter, T const& lower)
-> tl::expected<void, std::string> {
[[nodiscard]] auto lower_element_bounds(rclcpp::Parameter const& parameter,
T const& lower) -> tl::expected<void, std::string> {
auto const& param_value = parameter.get_value<std::vector<T>>();
for (auto val : param_value)
if (val < lower)
Expand All @@ -184,8 +184,8 @@ template <typename T>
* @return Help string if the parameter is invalid, otherwise void
*/
template <typename T>
[[nodiscard]] auto upper_element_bounds(rclcpp::Parameter const& parameter, T const& upper)
-> tl::expected<void, std::string> {
[[nodiscard]] auto upper_element_bounds(rclcpp::Parameter const& parameter,
T const& upper) -> tl::expected<void, std::string> {
auto const& param_value = parameter.get_value<std::vector<T>>();
for (auto val : param_value)
if (val > upper)
Expand All @@ -202,8 +202,8 @@ template <typename T>
* @return Help string if the parameter is invalid, otherwise void
*/
template <typename T>
[[nodiscard]] auto bounds(rclcpp::Parameter const& parameter, T const& lower, T const& upper)
-> tl::expected<void, std::string> {
[[nodiscard]] auto bounds(rclcpp::Parameter const& parameter, T const& lower,
T const& upper) -> tl::expected<void, std::string> {
auto const& param_value = parameter.get_value<T>();
if (param_value < lower || param_value > upper)
return tl::unexpected(
Expand Down Expand Up @@ -287,8 +287,8 @@ template <typename T>
* @return Help string if the parameter is invalid, otherwise void
*/
template <typename T>
[[nodiscard]] auto one_of(rclcpp::Parameter const& parameter, std::vector<T> const& collection)
-> tl::expected<void, std::string> {
[[nodiscard]] auto one_of(rclcpp::Parameter const& parameter,
std::vector<T> const& collection) -> tl::expected<void, std::string> {
auto const& param_value = parameter.get_value<T>();
if (contains(collection, param_value)) return {};
return tl::unexpected(fmt::format(
Expand Down
2 changes: 1 addition & 1 deletion include/rsl/strong_type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class StrongType {
/**
* @brief Get const reference to underlying value
*/
[[nodiscard]] constexpr const T& get() const { return value_; }
[[nodiscard]] constexpr T const& get() const { return value_; }

/**
* @brief Explicit conversion to underlying type
Expand Down
Loading