clang-tidy: fix variable/method naming

This commit is contained in:
Robert Haschke 2022-11-03 17:43:25 +01:00
parent 4f74af8fb7
commit 164ce4eab8
9 changed files with 19 additions and 18 deletions

View File

@ -86,7 +86,7 @@ public:
ARMED, // disabled state in a Connecting interface that will become re-enabled with a new opposite state ARMED, // disabled state in a Connecting interface that will become re-enabled with a new opposite state
PRUNED, // disabled state on a pruned solution branch PRUNED, // disabled state on a pruned solution branch
}; };
static const char* STATUS_COLOR[]; static const char* colorForStatus(unsigned int s) { return STATUS_COLOR_[s]; }
/** InterfaceStates are ordered according to two values: /** InterfaceStates are ordered according to two values:
* Depth of interlinked trajectory parts and accumulated trajectory costs along that path. * Depth of interlinked trajectory parts and accumulated trajectory costs along that path.
@ -157,6 +157,7 @@ private:
inline void setPriority(const Priority& prio) { priority_ = prio; } inline void setPriority(const Priority& prio) { priority_ = prio; }
private: private:
static const char* STATUS_COLOR_[];
planning_scene::PlanningSceneConstPtr scene_; planning_scene::PlanningSceneConstPtr scene_;
PropertyMap properties_; PropertyMap properties_;
/// trajectories which are *timewise before* this state /// trajectories which are *timewise before* this state

View File

@ -1052,6 +1052,7 @@ void FallbacksPrivateConnect::onNewFailure(const Stage& child, const InterfaceSt
// ... thus we can use std::next(active_) to find the next child // ... thus we can use std::next(active_) to find the next child
auto next = std::next(active_); auto next = std::next(active_);
// NOLINTNEXTLINE(readability-identifier-naming)
auto findIteratorFor = [](const InterfaceState* state, const Interface& interface) { auto findIteratorFor = [](const InterfaceState* state, const Interface& interface) {
auto it = std::find(interface.begin(), interface.end(), state); auto it = std::find(interface.begin(), interface.end(), state);
assert(it != interface.end()); assert(it != interface.end());
@ -1061,9 +1062,9 @@ void FallbacksPrivateConnect::onNewFailure(const Stage& child, const InterfaceSt
if (next != children().end()) { // pass job to next child if (next != children().end()) { // pass job to next child
auto next_con = static_cast<ConnectingPrivate*>(const_cast<StagePrivate*>((*next)->pimpl())); auto next_con = static_cast<ConnectingPrivate*>(const_cast<StagePrivate*>((*next)->pimpl()));
auto first_con = static_cast<const ConnectingPrivate*>(children().front()->pimpl()); auto first_con = static_cast<const ConnectingPrivate*>(children().front()->pimpl());
auto fromIt = findIteratorFor(from, *first_con->starts()); auto from_it = findIteratorFor(from, *first_con->starts());
auto toIt = findIteratorFor(to, *first_con->ends()); auto to_it = findIteratorFor(to, *first_con->ends());
next_con->pending.insert(std::make_pair(fromIt, toIt)); next_con->pending.insert(std::make_pair(from_it, to_it));
} else // or report failure to parent } else // or report failure to parent
parent()->pimpl()->onNewFailure(*me(), from, to); parent()->pimpl()->onNewFailure(*me(), from, to);
} }

View File

@ -854,12 +854,12 @@ void ConnectingPrivate::compute() {
} }
std::ostream& ConnectingPrivate::printPendingPairs(std::ostream& os) const { std::ostream& ConnectingPrivate::printPendingPairs(std::ostream& os) const {
const char* reset = InterfaceState::STATUS_COLOR[3]; const char* reset = InterfaceState::colorForStatus(3);
for (const auto& candidate : pending) { for (const auto& candidate : pending) {
size_t first = getIndex(*starts(), candidate.first); size_t first = getIndex(*starts(), candidate.first);
size_t second = getIndex(*ends(), candidate.second); size_t second = getIndex(*ends(), candidate.second);
os << InterfaceState::STATUS_COLOR[candidate.first->priority().status()] << first << reset << ":" os << InterfaceState::colorForStatus(candidate.first->priority().status()) << first << reset << ":"
<< InterfaceState::STATUS_COLOR[candidate.second->priority().status()] << second << reset << " "; << InterfaceState::colorForStatus(candidate.second->priority().status()) << second << reset << " ";
} }
if (pending.empty()) if (pending.empty())
os << "---"; os << "---";

View File

@ -242,7 +242,7 @@ bool MoveRelative::compute(const InterfaceState& state, planning_scene::Planning
// linear+angular are expressed w.r.t. model frame and thus we need left-multiplication // linear+angular are expressed w.r.t. model frame and thus we need left-multiplication
linear = frame_pose.linear() * linear; linear = frame_pose.linear() * linear;
angular = frame_pose.linear() * angular; angular = frame_pose.linear() * angular;
auto R = Eigen::AngleAxisd(angular_norm, angular); auto R = Eigen::AngleAxisd(angular_norm, angular); // NOLINT(readability-identifier-naming)
auto p = ik_pose_world.translation(); auto p = ik_pose_world.translation();
target_eigen = Eigen::Translation3d(linear + p - R * p) * (R * ik_pose_world); target_eigen = Eigen::Translation3d(linear + p - R * p) * (R * ik_pose_world);
goto COMPUTE; goto COMPUTE;

View File

@ -167,7 +167,7 @@ std::ostream& operator<<(std::ostream& os, const Interface& interface) {
os << istate->priority() << " "; os << istate->priority() << " ";
return os; return os;
} }
const char* InterfaceState::STATUS_COLOR[] = { const char* InterfaceState::STATUS_COLOR_[] = {
"\033[32m", // ENABLED - green "\033[32m", // ENABLED - green
"\033[33m", // ARMED - yellow "\033[33m", // ARMED - yellow
"\033[31m", // PRUNED - red "\033[31m", // PRUNED - red
@ -175,8 +175,8 @@ const char* InterfaceState::STATUS_COLOR[] = {
}; };
std::ostream& operator<<(std::ostream& os, const InterfaceState::Priority& prio) { std::ostream& operator<<(std::ostream& os, const InterfaceState::Priority& prio) {
// maps InterfaceState::Status values to output (color-changing) prefix // maps InterfaceState::Status values to output (color-changing) prefix
os << InterfaceState::STATUS_COLOR[prio.status()] << prio.depth() << ":" << prio.cost() os << InterfaceState::colorForStatus(prio.status()) << prio.depth() << ":" << prio.cost()
<< InterfaceState::STATUS_COLOR[3]; << InterfaceState::colorForStatus(3);
return os; return os;
} }
std::ostream& operator<<(std::ostream& os, Interface::Direction dir) { std::ostream& operator<<(std::ostream& os, Interface::Direction dir) {

View File

@ -225,7 +225,7 @@ TaskViewPrivate::TaskViewPrivate(TaskView* view) : q_ptr(view), exec_action_clie
meta_model->setMimeTypes({ factory->mimeType() }); meta_model->setMimeTypes({ factory->mimeType() });
tasks_view->setModel(meta_model); tasks_view->setModel(meta_model);
QObject::connect(meta_model, SIGNAL(rowsInserted(QModelIndex, int, int)), q_ptr, QObject::connect(meta_model, SIGNAL(rowsInserted(QModelIndex, int, int)), q_ptr,
SLOT(_q_configureInsertedModels(QModelIndex, int, int))); SLOT(configureInsertedModels(QModelIndex, int, int)));
tasks_view->setSelectionMode(QAbstractItemView::ExtendedSelection); tasks_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
tasks_view->setAcceptDrops(true); tasks_view->setAcceptDrops(true);
@ -261,7 +261,7 @@ void TaskViewPrivate::configureExistingModels() {
configureTaskListModel(meta_model->getTaskListModel(meta_model->index(row, 0)).first); configureTaskListModel(meta_model->getTaskListModel(meta_model->index(row, 0)).first);
} }
void TaskViewPrivate::_q_configureInsertedModels(const QModelIndex& parent, int first, int last) { void TaskViewPrivate::configureInsertedModels(const QModelIndex& parent, int first, int last) {
if (parent.isValid() && !parent.parent().isValid()) { // top-level task items inserted if (parent.isValid() && !parent.parent().isValid()) { // top-level task items inserted
int expand = q_ptr->initial_task_expand->getOptionInt(); int expand = q_ptr->initial_task_expand->getOptionInt();
for (int row = first; row <= last; ++row) { for (int row = first; row <= last; ++row) {

View File

@ -156,7 +156,7 @@ protected Q_SLOTS:
void onOldTaskHandlingChanged(); void onOldTaskHandlingChanged();
private: private:
Q_PRIVATE_SLOT(d_ptr, void _q_configureInsertedModels(QModelIndex, int, int)); Q_PRIVATE_SLOT(d_ptr, void configureInsertedModels(QModelIndex, int, int));
Q_SIGNALS: Q_SIGNALS:
void oldTaskHandlingChanged(int old_task_handling); void oldTaskHandlingChanged(int old_task_handling);

View File

@ -82,9 +82,8 @@ public:
void configureTaskListModel(TaskListModel* model); void configureTaskListModel(TaskListModel* model);
/// configure all TaskListModels that were already created when TaskView gets instantiated /// configure all TaskListModels that were already created when TaskView gets instantiated
void configureExistingModels(); void configureExistingModels();
// NOLINTNEXTLINE(readability-identifier-naming)
/// configure newly inserted models /// configure newly inserted models
void _q_configureInsertedModels(const QModelIndex& parent, int first, int last); void configureInsertedModels(const QModelIndex& parent, int first, int last);
/// unlock locked_display_ if given display is different /// unlock locked_display_ if given display is different
void lock(TaskDisplay* display); void lock(TaskDisplay* display);

View File

@ -238,8 +238,8 @@ int main(int argc, char** argv) {
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
QTimer::singleShot(0, [&]() { QTimer::singleShot(0, [&]() {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
auto testResult = RUN_ALL_TESTS(); auto test_result = RUN_ALL_TESTS();
app.exit(testResult); app.exit(test_result);
}); });
return app.exec(); return app.exec();
} }