Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-with-eclipse-ecal-2024-07-17 #73

Merged
merged 7 commits into from
Jul 17, 2024

Conversation

rex-schilasky
Copy link
Contributor

sync-with-eclipse-ecal-2024-07-17

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 20 out of 33. Check the log or trigger a new build to see more.

std::string ecal_ini_file_path{};

private:
ECAL_API void Init(std::vector<std::string>& args_);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'eCAL::Configuration::Init' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]

    ECAL_API void Init(std::vector<std::string>& args_);
                  ^
Additional context

ecal/core/src/config/ecal_config_initializer.cpp:229: the definition seen here

    void Configuration::Init(std::vector<std::string>& arguments_)
                        ^

ecal/core/include/ecal/config/configuration.h:77: differing parameters are named here: ('args_'), in definition: ('arguments_')

    ECAL_API void Init(std::vector<std::string>& args_);
                  ^

@@ -26,13 +26,15 @@

#include <ecal/ecal.h>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'ecal/ecal.h' file not found [clang-diagnostic-error]

#include <ecal/ecal.h>
         ^

class ProtobufDynamicJSONDeserializer
{
public:
std::string Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: method 'Deserialize' can be made static [readability-convert-member-functions-to-static]

Suggested change
std::string Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_)
static std::string Deserialize(const void* buffer_, size_t size_, const SDataTypeInformation& datatype_info_)

m_msg_callback = callback_;
return true;
}
std::string binary_input;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'binary_input' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string binary_input;
std::string binary_input = 0;

}
std::string binary_input;
binary_input.assign(static_cast<const char*>(buffer_), static_cast<size_t>(size_));
std::string json_output;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'json_output' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string json_output;
std::string json_output = 0;

@@ -33,6 +34,7 @@ namespace eCAL
std::atomic<int> g_globals_ctx_ref_cnt;

std::string g_default_ini_file(ECAL_DEFAULT_CFG);
Configuration g_ecal_configuration{};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'g_ecal_configuration' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

  Configuration                 g_ecal_configuration{};
                                ^

{
return g_globals_ctx;
g_globals_ctx = new CGlobals;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: assigning newly created 'gsl::owner<>' to non-owner 'CGlobals *' [cppcoreguidelines-owning-memory]

    g_globals_ctx = new CGlobals;
    ^

#endif

// declaration of globally accessible variables
extern CGlobals* g_globals_ctx;
extern std::atomic<int> g_globals_ctx_ref_cnt;

extern std::string g_default_ini_file;
extern Configuration g_ecal_configuration;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'g_ecal_configuration' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

  extern Configuration                 g_ecal_configuration;
                                       ^

Configuration::Configuration() :
share_topic_type(eCAL::Config::IsTopicTypeSharingEnabled()),
share_topic_description(eCAL::Config::IsTopicDescriptionSharingEnabled())
Configuration::Configuration()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: constructor does not initialize these fields: share_topic_type, share_topic_description [cppcoreguidelines-pro-type-member-init]

ecal/core/include/ecal/config/publisher.h:142:

-       bool                 share_topic_type;                            //!< share topic type via registration
-       bool                 share_topic_description;                     //!< share topic description via registration
+       bool                 share_topic_type{};                            //!< share topic type via registration
+       bool                 share_topic_description{};                     //!< share topic description via registration

@@ -258,6 +169,12 @@ namespace eCAL
m_sample_list.samples.clear();
}

void CRegistrationProvider::SendSampleList()
{
std::lock_guard<std::mutex> lock(m_sample_list_mtx);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'lock' of type 'std::lock_guardstd::mutex' can be declared 'const' [misc-const-correctness]

Suggested change
std::lock_guard<std::mutex> lock(m_sample_list_mtx);
std::lock_guard<std::mutex> const lock(m_sample_list_mtx);

@rex-schilasky rex-schilasky merged commit 25e4785 into main Jul 17, 2024
81 of 82 checks passed
@rex-schilasky rex-schilasky deleted the sync-with-eclipse-ecal-2024-07-17 branch July 17, 2024 12:15
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


std::shared_ptr<UDP::CSampleSender> m_reg_sample_snd;
std::shared_ptr<CCallbackThread> m_reg_sample_snd_thread;
static std::atomic<bool> m_created;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'm_created' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

    static std::atomic<bool>             m_created;
                                         ^


int main(int argc, char **argv)
{
int run(0), runs(1000);
int run(0), runs(10);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: multiple declarations in a single statement reduces readability [readability-isolate-declaration]

Suggested change
int run(0), runs(10);
int run(0);
int runs(10);


// Transport layer options
const bool drop_out_of_order_messages = true;
std::string ip_address = "238.200.100.2";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'ip_address' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string ip_address = "238.200.100.2";
std::string const ip_address = "238.200.100.2";

// test copy method for config structure
eCAL::Configuration config1(0, nullptr);
eCAL::Configuration config2(0, nullptr);
std::string testValue = std::string("234.0.3.2");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'testValue' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string testValue = std::string("234.0.3.2");
std::string const testValue = std::string("234.0.3.2");

const std::string reg_to_value = "6000";
const std::string reg_rf_value = "1000";

arguments.push_back("test_config_cmd_parser");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use emplace_back instead of push_back [modernize-use-emplace]

Suggested change
arguments.push_back("test_config_cmd_parser");
arguments.emplace_back("test_config_cmd_parser");

}

private:
static duration current_time;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'current_time' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

  static duration current_time;
                  ^

};

// Initialize the static member
TestingClock::duration TestingClock::current_time{ 0 };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'current_time' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

TestingClock::duration TestingClock::current_time{ 0 };
                                     ^

auto max_lines(10);
auto receive_lambda = [&received, &max_lines](const char* /*topic_name_*/, const struct eCAL::SReceiveCallbackData* data_)
{
if (max_lines)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]

Suggested change
if (max_lines)
if (max_lines != 0)

long long time_point;
};

std::vector<command> commands =

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'commands' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]

std::vector<command> commands =
                     ^


for (const auto& command : commands)
{
std::chrono::steady_clock::time_point time(std::chrono::milliseconds(command.time_point));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'time' of type 'std::chrono::steady_clock::time_point' (aka 'time_point<std::chrono::steady_clock, duration<long, ratio<1, 1000000000>>>') can be declared 'const' [misc-const-correctness]

Suggested change
std::chrono::steady_clock::time_point time(std::chrono::milliseconds(command.time_point));
std::chrono::steady_clock::time_point const time(std::chrono::milliseconds(command.time_point));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant