Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Today's sonar/codefactor issues.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 May 2022 08:37:38 +0000 (10:37 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 20 May 2022 09:09:24 +0000 (11:09 +0200)
examples/platforms/supernode.cpp
examples/platforms/supernode.py
src/kernel/activity/ExecImpl.cpp
teshsuite/s4u/comm-fault-scenarios/comm-fault-scenarios.cpp

index d3f9126..2b4afb8 100644 (file)
@@ -94,7 +94,7 @@ static sg4::NetZone* create_cluster(const std::string& cluster_name, const int n
 }
 
 extern "C" void load_platform(const sg4::Engine& e);
-void load_platform(const sg4::Engine& e)
+void load_platform(const sg4::Engine&)
 {
   create_cluster("cluster", 4, 6, 2)->seal();
 }
index 5ffde32..a75c735 100755 (executable)
@@ -52,35 +52,35 @@ def load_graph(platform_csv):
     return G
 
 
-def plot_graph(G, label=False, groups=[]):
+def plot_graph(graph, label=False, groups=[]):
     # First, we compute the graph layout, i.e. the position of the nodes.
     # The neato algorithm from graphviz is nicer, but this is an extra-dependency.
     # The spring_layout is also not too bad.
     try:
-        pos = nx.nx_agraph.graphviz_layout(G, 'neato')
+        pos = nx.nx_agraph.graphviz_layout(graph, 'neato')
     except ImportError:
         print('Warning: could not import pygraphviz, will use another layout algorithm.')
-        pos = nx.spring_layout(G, k=0.5, iterations=1000, seed=42)
+        pos = nx.spring_layout(graph, k=0.5, iterations=1000, seed=42)
     plt.figure(figsize=(20, 15))
     plt.axis('off')
-    all_nodes = set(G)
+    all_nodes = set(graph)
     # We then iterate on all the specified groups, to plot each of them in the right color.
     # Note that the order of the groups is important here, as we are looking at substrings in the node names.
     for i, grp in enumerate(groups):
         nodes = {u for u in all_nodes if grp in u}
         all_nodes -= nodes
-        nx.draw_networkx_nodes(G, pos, nodelist=nodes, node_size=50, node_color=colors[i], label=grp.replace('_', ''))
-    nx.draw_networkx_nodes(G, pos, nodelist=all_nodes, node_size=50, node_color=colors[-1], label='unknown')
+        nx.draw_networkx_nodes(graph, pos, nodelist=nodes, node_size=50, node_color=colors[i], label=grp.replace('_', ''))
+    nx.draw_networkx_nodes(graph, pos, nodelist=all_nodes, node_size=50, node_color=colors[-1], label='unknown')
     # Finally we draw the edges, the (optional) labels, and the legend.
-    nx.draw_networkx_edges(G, pos, alpha=0.3)
+    nx.draw_networkx_edges(graph, pos, alpha=0.3)
     if label:
-        nx.draw_networkx_labels(G, pos)
+        nx.draw_networkx_labels(graph, pos)
     plt.legend(scatterpoints = 1)
 
 
 def generate_svg(platform_csv):
-    G = load_graph(platform_csv)
-    plot_graph(G, label=False, groups=['router', 'link', 'cpu', '_node', 'supernode', 'cluster'])
+    graph = load_graph(platform_csv)
+    plot_graph(graph, label=False, groups=['router', 'link', 'cpu', '_node', 'supernode', 'cluster'])
     img = platform_csv.replace('.csv', '.svg')
     plt.savefig(img)
     print(f'Generated file {img}')
index 503e2c5..32bbd8a 100644 (file)
@@ -145,8 +145,8 @@ ExecImpl& ExecImpl::update_sharing_penalty(double sharing_penalty)
 void ExecImpl::post()
 {
   xbt_assert(surf_action_ != nullptr);
-  auto const& hosts = get_hosts();
-  if (std::any_of(hosts.begin(), hosts.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
+  if (auto const& hosts = get_hosts();
+      std::any_of(hosts.begin(), hosts.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
     /* If one of the hosts running the synchro failed, notice it. This way, the asking
      * process can be killed if it runs on that host itself */
     set_state(State::FAILED);
index cec1e2a..2a919d3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2022. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -105,7 +105,6 @@ sg4::Mailbox* mbox_eager = nullptr;
 sg4::Mailbox* mbox_rdv   = nullptr;
 
 class SendAgent {
-
   static int run_;
   static size_t scenario_;
   int id_;
@@ -231,7 +230,6 @@ size_t SendAgent::scenario_ = 0;
 /*************************************************************************************************/
 
 class ReceiveAgent {
-
   static int run_;
   static size_t scenario_;
   int id_;