feat(tidy): add fairmq-modernize-channels-access

- Report uses of the deprecated member fair::mq::Device::fChannels.
- Replace fChannels.at(name).at(index) with GetChannel(name, index) and
  every other use with GetChannels().
- Ignore uses inside fair::mq::Device itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 22:39:03 +00:00
parent d4a3c06c7b
commit 84ac7aecfd
5 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
/********************************************************************************
* Copyright (C) 2026 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#ifndef FAIR_MQ_TIDY_CHANNELSACCESSCHECK_H
#define FAIR_MQ_TIDY_CHANNELSACCESSCHECK_H
#include <clang-tidy/ClangTidyCheck.h>
namespace fair::mq::tidy {
/// Finds uses of the deprecated data member `fair::mq::Device::fChannels`:
/// - `fChannels.at(name).at(index)` becomes `GetChannel(name, index)`,
/// - every other use of `fChannels` becomes `GetChannels()`.
class ChannelsAccessCheck : public clang::tidy::ClangTidyCheck
{
public:
using ClangTidyCheck::ClangTidyCheck;
bool isLanguageVersionSupported(clang::LangOptions const& opts) const override
{
return opts.CPlusPlus17;
}
void registerMatchers(clang::ast_matchers::MatchFinder* finder) override;
void check(clang::ast_matchers::MatchFinder::MatchResult const& result) override;
};
} // namespace fair::mq::tidy
#endif /* FAIR_MQ_TIDY_CHANNELSACCESSCHECK_H */