@@ -78,8 +78,8 @@ static ParsedConfigMap parse_config_map(const json& config_map_schema, const jso
7878
7979 // validate each config entry
8080 for (const auto & config_entry_el : config_map_schema.items ()) {
81- const std::string config_entry_name = config_entry_el.key ();
82- const json config_entry = config_entry_el.value ();
81+ const std::string& config_entry_name = config_entry_el.key ();
82+ const json& config_entry = config_entry_el.value ();
8383
8484 // only convenience exception, would be catched by schema validation below if not thrown here
8585 if (!config_entry.contains (" default" ) and !config_map.contains (config_entry_name)) {
@@ -125,7 +125,7 @@ static auto get_provides_for_probe_module(const std::string& probe_module_id, co
125125 const auto & connections = module_config.value (" connections" , json::object ());
126126
127127 for (const auto & connection : connections.items ()) {
128- const std::string req_id = connection.key ();
128+ const std::string& req_id = connection.key ();
129129 const std::string module_name = module_config.at (" module" );
130130 const auto & module_manifest = manifests.at (module_name);
131131
@@ -161,7 +161,7 @@ static auto get_provides_for_probe_module(const std::string& probe_module_id, co
161161
162162static auto get_requirements_for_probe_module (const std::string& probe_module_id, const json& config,
163163 const json& manifests) {
164- const auto probe_module_config = config.at (probe_module_id);
164+ const auto & probe_module_config = config.at (probe_module_id);
165165
166166 auto requirements = json::object ();
167167
@@ -181,22 +181,23 @@ static auto get_requirements_for_probe_module(const std::string& probe_module_id
181181
182182 if (module_config_it == config.end ()) {
183183 EVLOG_AND_THROW (
184- EverestConfigError (" ProbeModule refers to a non-existent module id '" + module_id + " ' " ));
184+ EverestConfigError (fmt::format ( " ProbeModule refers to a non-existent module id '{}' " , module_id) ));
185185 }
186186
187187 const auto & module_manifest = manifests.at (module_config_it->at (" module" ));
188188
189189 const auto & module_provides_it = module_manifest.find (" provides" );
190190
191191 if (module_provides_it == module_manifest.end ()) {
192- EVLOG_AND_THROW (EverestConfigError (" ProbeModule requires something from module id' " + module_id +
193- " ', but it does not provide anything" ));
192+ EVLOG_AND_THROW (EverestConfigError (fmt::format (
193+ " ProbeModule requires something from module id '{}' but it does not provide anything" , module_id) ));
194194 }
195195
196196 const auto & provide_it = module_provides_it->find (impl_id);
197197 if (provide_it == module_provides_it->end ()) {
198- EVLOG_AND_THROW (EverestConfigError (" ProbeModule requires something from module id '" + module_id +
199- " ', but it does not provide '" + impl_id + " '" ));
198+ EVLOG_AND_THROW (EverestConfigError (
199+ fmt::format (" ProbeModule requires something from module id '{}', but it does not provide '{}'" ,
200+ module_id, impl_id)));
200201 }
201202
202203 const std::string interface = provide_it->at (" interface" );
@@ -269,7 +270,7 @@ std::string create_printable_identifier(const ImplementationInfo& info, const st
269270 BOOST_LOG_FUNCTION ();
270271
271272 // no implementation id yet so only return this kind of string:
272- const auto module_string = fmt::format (" {}:{}" , info.module_id , info.module_name );
273+ auto module_string = fmt::format (" {}:{}" , info.module_id , info.module_name );
273274 if (impl_id.empty ()) {
274275 return module_string;
275276 }
@@ -579,7 +580,7 @@ void ManagerConfig::load_and_validate_manifest(const std::string& module_id, con
579580
580581 // validate config for !module
581582 {
582- const json config_map = module_config.at (" config_module" );
583+ const json& config_map = module_config.at (" config_module" );
583584 const json config_map_schema = this ->manifests [module_config.at (" module" ).get <std::string>()][" config" ];
584585
585586 try {
@@ -887,7 +888,7 @@ void ManagerConfig::resolve_all_requirements() {
887888}
888889
889890void ManagerConfig::parse (json config) {
890- this ->main = config;
891+ this ->main = std::move ( config) ;
891892 // load type files
892893 if (this ->ms .runtime_settings ->validate_schema ) {
893894 int64_t total_time_validation_ms = 0 , total_time_parsing_ms = 0 ;
@@ -1167,7 +1168,7 @@ ModuleConfigs Config::get_module_configs(const std::string& module_id) const {
11671168 for (const auto & entry : conf_map.value ().items ()) {
11681169 const json entry_type = config_schema.at (entry.key ()).at (" type" );
11691170 ConfigEntry value;
1170- const json data = entry.value ();
1171+ const json& data = entry.value ();
11711172
11721173 if (data.is_string ()) {
11731174 value = data.get <std::string>();
@@ -1239,7 +1240,7 @@ void Config::ref_loader(const json_uri& uri, json& schema) {
12391240 schema = nlohmann::json_schema::draft7_schema_builtin;
12401241 return ;
12411242 } else {
1242- const auto path = uri.path ();
1243+ const auto & path = uri.path ();
12431244 if (this ->types .contains (path)) {
12441245 schema = this ->types [path];
12451246 EVLOG_verbose << fmt::format (" ref path \" {}\" schema has been found." , path);
0 commit comments