Skip to content

Commit

Permalink
examples: Minor linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
taminob committed Mar 15, 2024
1 parent bc4d932 commit 6c580ca
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion examples/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ InheritParentConfig: true
# exceptions for testing
Checks: >
-readability-magic-numbers,
-cppcoreguidelines-pro-bounds-pointer-arithmetic
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-avoid-non-const-global-variables
8 changes: 4 additions & 4 deletions examples/configurable_plugin/configurable_plugin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#define PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#ifndef PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H
#define PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H

#include <iostream>
#include <memory>
Expand Down Expand Up @@ -28,7 +28,7 @@ class ConfigurablePluginInterface {
template <typename T>
void print(T&& arg)
{
std::cout << arg << std::flush;
std::cout << std::forward<T>(arg) << std::flush;
}
static void sleep(std::chrono::milliseconds duration)
{
Expand All @@ -53,4 +53,4 @@ class ConfigurablePluginA : public ConfigurablePluginInterface {
void loop(const std::atomic<bool>& stop) override;
};

#endif // PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#endif // PPPLUGIN_EXAMPLES_CONFIGURABLE_PLUGIN_H
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ int main(int argc, char* argv[])
std::cerr << "A fatal error occurred: '" << exception.what() << "'\n";
return 1;
} catch (...) {
std::cerr << "An unknown fatal error occurred!";
std::cerr << "An unknown fatal error occurred!\n";
return 1;
}
return 0;
Expand Down
8 changes: 4 additions & 4 deletions examples/simple_plugin/simple_plugin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#define PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#ifndef PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H
#define PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H

#include <iostream>
#include <memory>
Expand All @@ -21,7 +21,7 @@ class SimplePluginInterface {
template <typename T>
void print(T&& arg)
{
std::cout << arg << std::flush;
std::cout << std::forward<T>(arg) << std::flush;
}
static void sleep(std::chrono::milliseconds duration)
{
Expand All @@ -44,4 +44,4 @@ class SimplePluginA : public SimplePluginInterface {
int i_ { 0 };
};

#endif // PPPLUGIN__EXAMPLES__SIMPLE_PLUGIN_H
#endif // PPPLUGIN_EXAMPLES_SIMPLE_PLUGIN_H
6 changes: 3 additions & 3 deletions examples/simple_plugin/simple_plugin_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void printError(std::string_view function_name, const ppplugin::CallError& error
: error == ppplugin::CallError::Code::unknown ? "unknown error"
: "other error";
std::cerr << "Unable to call '" << function_name << "' ('" << error_string
<< "')!" << std::endl;
<< "')!\n";
}

void printError(std::string_view plugin_name, ppplugin::LoadError error)
Expand All @@ -22,7 +22,7 @@ void printError(std::string_view plugin_name, ppplugin::LoadError error)
: error == LoadError::unknown ? "unknown error"
: "other error";
std::cerr << "Unable to load '" << plugin_name << "' ('" << error_string
<< "')!" << std::endl;
<< "')!\n";
}

template <typename ClassType>
Expand Down Expand Up @@ -66,7 +66,7 @@ int main(int argc, char* argv[])
std::cerr << "A fatal error occurred: '" << exception.what() << "'\n";
return 1;
} catch (...) {
std::cerr << "An unknown fatal error occurred!";
std::cerr << "An unknown fatal error occurred!\n";
return 1;
}
return 0;
Expand Down

0 comments on commit 6c580ca

Please sign in to comment.