From: Martin Quinson Date: Tue, 23 May 2017 23:29:05 +0000 (+0200) Subject: cosmetics to please codacy X-Git-Tag: v3.16~228^2~6 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e44a0d71a8bacd7ab03e284fc32ad23731f5869c cosmetics to please codacy --- diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index 8f0c25d488..581db40333 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -209,7 +209,7 @@ void bindPromise(Promise promise, Future future) { struct PromiseBinder { public: - PromiseBinder(Promise promise) : promise_(std::move(promise)) {} + explicit PromiseBinder(Promise promise) : promise_(std::move(promise)) {} void operator()(Future future) { simgrid::xbt::setPromise(promise_, future); @@ -282,7 +282,7 @@ template class Future { public: Future() = default; - Future(std::shared_ptr> state): state_(std::move(state)) {} + explicit Future(std::shared_ptr> state) : state_(std::move(state)) {} // Move type: Future(Future&) = delete; @@ -454,8 +454,8 @@ Future unwrapFuture(Future> future) template class Promise { public: - Promise() : state_(std::make_shared>()) {} - Promise(std::shared_ptr> state) : state_(std::move(state)) {} + explicit Promise() : state_(std::make_shared>()) {} + explicit Promise(std::shared_ptr> state) : state_(std::move(state)) {} // Move type Promise(Promise const&) = delete; diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index 463cadf654..dce4b1eb0e 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -244,7 +244,6 @@ void DefineContainerEvent::print() { } - DefineVariableTypeEvent::DefineVariableTypeEvent(type_t type) { this->event_type = PAJE_DefineVariableType; diff --git a/src/simgrid/sg_config.cpp b/src/simgrid/sg_config.cpp index 22ac71025f..8aa0849048 100644 --- a/src/simgrid/sg_config.cpp +++ b/src/simgrid/sg_config.cpp @@ -575,7 +575,7 @@ void sg_config_init(int *argc, char **argv) void sg_config_finalize() { - if (!_sg_cfg_init_status) + if (not _sg_cfg_init_status) return; /* Not initialized yet. Nothing to do */ xbt_cfg_free(&simgrid_config); diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index d0f33d408c..7474d22665 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -233,13 +233,13 @@ def header(name): def handle(fd, func, simcalls, guarded_simcalls): - def nonempty(e): + def nonempty(e): return e != '' fd.write('\n'.join(filter(nonempty, (func(simcall) for simcall in simcalls)))) - for guard, list in guarded_simcalls.items(): + for guard, ll in guarded_simcalls.items(): fd.write('\n#if %s\n' % (guard)) - fd.write('\n'.join(func(simcall) for simcall in list)) + fd.write('\n'.join(func(simcall) for simcall in ll)) fd.write('\n#endif\n') if __name__ == '__main__': diff --git a/src/smpi/smpi_group.cpp b/src/smpi/smpi_group.cpp index 590ba5e88b..f12c5cfa7c 100644 --- a/src/smpi/smpi_group.cpp +++ b/src/smpi/smpi_group.cpp @@ -24,22 +24,16 @@ Group::Group() Group::Group(int n) : size_(n) { - int i; rank_to_index_map_ = xbt_new(int, size_); index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f); refcount_ = 1; - for (i = 0; i < size_; i++) { + for (int i = 0; i < size_; i++) { rank_to_index_map_[i] = MPI_UNDEFINED; } } Group::Group(MPI_Group origin) { - char *key; - char *ptr_rank; - xbt_dict_cursor_t cursor = nullptr; - - int i; if(origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) { @@ -47,10 +41,13 @@ Group::Group(MPI_Group origin) rank_to_index_map_ = xbt_new(int, size_); index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f); refcount_ = 1; - for (i = 0; i < size_; i++) { + for (int i = 0; i < size_; i++) { rank_to_index_map_[i] = origin->rank_to_index_map_[i]; } + char* key; + char* ptr_rank; + xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) { int * cp = static_cast(xbt_malloc(sizeof(int))); *cp=*reinterpret_cast(ptr_rank); @@ -130,13 +127,12 @@ int Group::compare(MPI_Group group2) int i; int index; int rank; - int sz; result = MPI_IDENT; if (size_ != group2->size()) { result = MPI_UNEQUAL; } else { - sz = group2->size(); + int sz = group2->size(); for (i = 0; i < sz; i++) { index = this->index(i); rank = group2->rank(index); diff --git a/src/smpi/smpi_group.hpp b/src/smpi/smpi_group.hpp index aa01f3c318..9c40f5e530 100644 --- a/src/smpi/smpi_group.hpp +++ b/src/smpi/smpi_group.hpp @@ -19,9 +19,9 @@ class Group : public F2C{ xbt_dict_t index_to_rank_map_; int refcount_; public: - Group(); - Group(int size); - Group(Group* origin); + explicit Group(); + explicit Group(int size); + explicit Group(Group* origin); ~Group(); void set_mapping(int index, int rank); diff --git a/tools/tesh/tesh.py b/tools/tesh/tesh.py index 7febe402c0..be40773fc6 100755 --- a/tools/tesh/tesh.py +++ b/tools/tesh/tesh.py @@ -28,7 +28,7 @@ under the terms of the license (GNU LGPL) which comes with this package. # print "WARNING: Output were only sorted using the $sort_prefix first chars.\n" # if ( $sort_prefix > 0 ); # print "WARNING: Use to sort by simulated date and process ID only.\n"; -# +# # print "----8<--------------- Begin of unprocessed observed output (as it should appear in file):\n"; # map {print "> $_\n"} @{$cmd{'unsorted got'}}; # print "--------------->8---- End of the unprocessed observed output.\n"; @@ -292,7 +292,7 @@ class Cmd(object): self.timeout *= 20 self.args = TeshState().wrapper + self.args elif re.match(".*smpirun.*", self.args) is not None: - self.args = "sh " + self.args + self.args = "sh " + self.args if TeshState().jenkins and self.timeout != None: self.timeout *= 10