From b5fb663bc8e6aad92c84588cde750815258cbcab Mon Sep 17 00:00:00 2001 From: Sean Robinson Date: Mon, 7 Feb 2022 14:29:32 -0700 Subject: [PATCH] Enable clang-tidy readability-named-parameter check Adds names recommended by clang-tidy (e.g. "unused"). Note that clang-tidy v12 appears to detect unnamed parameters in lambdas, while clang-tidy v13 does not. Signed-off-by: Sean Robinson --- .clang-tidy | 1 - include/argparse/argparse.hpp | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 812baacd..107ed936 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,7 +3,6 @@ Checks: readability-*, -readability-else-after-return, -readability-function-cognitive-complexity, - -readability-named-parameter, -readability-qualified-auto, -readability-static-accessed-through-instance, diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index ec27b9d6..8bce3ab5 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -150,7 +150,7 @@ constexpr bool standard_integer = template constexpr decltype(auto) apply_plus_one_impl(F &&f, Tuple &&t, Extra &&x, - std::index_sequence) { + std::index_sequence unused) { return std::invoke(std::forward(f), std::get(std::forward(t))..., std::forward(x)); } @@ -347,11 +347,11 @@ class ArgumentParser; class Argument { friend class ArgumentParser; - friend auto operator<<(std::ostream &, ArgumentParser const &) + friend auto operator<<(std::ostream &stream, const ArgumentParser &parser) -> std::ostream &; template - explicit Argument(std::string_view(&&a)[N], std::index_sequence) + explicit Argument(std::string_view(&&a)[N], std::index_sequence unused) : mIsOptional((is_optional(a[I]) || ...)), mIsRequired(false), mIsRepeatable(false), mIsUsed(false) { ((void)mNames.emplace_back(a[I]), ...); @@ -866,7 +866,7 @@ class ArgumentParser { : mProgramName(std::move(aProgramName)), mVersion(std::move(aVersion)) { if ((aArgs & default_arguments::help) == default_arguments::help) { add_argument("-h", "--help") - .action([&](const auto &) { + .action([&](const auto &unused) { std::cout << help().str(); std::exit(0); }) @@ -877,7 +877,7 @@ class ArgumentParser { } if ((aArgs & default_arguments::version) == default_arguments::version) { add_argument("-v", "--version") - .action([&](const auto &) { + .action([&](const auto &unused) { std::cout << mVersion; std::exit(0); })