]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use consistent brace style for blocks (1tbs)
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 15 Jul 2018 14:26:12 +0000 (17:26 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 15 Jul 2018 14:26:12 +0000 (17:26 +0300)
.eslintrc.json
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/stats.js
interface/js/app/symbols.js
interface/js/app/upload.js

index 3e52ed7f89821963fa90dc1d99abd74dff9be3d3..d62daffcfd1c8e6323bdd4e30e0cd7a9f54d5cbd 100644 (file)
@@ -8,6 +8,7 @@
     },
     "rules": {
         "array-bracket-newline": ["error", "consistent"],
+        "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
         "camelcase": "off",
         "capitalized-comments": "off",
         "comma-dangle": ["error", "only-multiline"],
@@ -49,7 +50,6 @@
         // Temporarily disabled rules
         "array-callback-return": "off",
         "array-element-newline": "off",
-        "brace-style": "off",
         "callback-return": "off",
         "consistent-return": "off",
         "consistent-this": "off",
index c7e0041ea0b0448c47b61cf9232e663fc5eb4175..bb643105688e56f864f53c798e6ba14e0f757fe5 100644 (file)
@@ -241,8 +241,7 @@ define(["jquery", "d3evolution", "footable"],
                             });
                             updateWidgets(data);
                         });
-                    }
-                    else {
+                    } else {
                         updateWidgets(neighbours_data[0]);
                     }
                 },
index def1703344cb22587c4b1b02b37ba01f87929825..bfbc838748bee0e25357d555a90b7f070ce3a716 100644 (file)
@@ -578,8 +578,7 @@ define(["jquery", "footable", "humanize"],
                                     return e.rows;
                                 }));
                             data.version = neighbours_data[0].version;
-                        }
-                        else {
+                        } else {
                         // Legacy version
                             data = [].concat.apply([], neighbours_data);
                         }
@@ -616,8 +615,7 @@ define(["jquery", "footable", "humanize"],
                         delete ft.history;
                     }
                 });
-            }
-            else {
+            } else {
                 $.ajax({
                     dataType: "json",
                     url: neighbours[checked_server].url + "history",
@@ -688,8 +686,7 @@ define(["jquery", "footable", "humanize"],
                         ui.getHistory(rspamd, tables, neighbours, checked_server);
                         ui.getErrors(rspamd, tables, neighbours, checked_server);
                     });
-                }
-                else {
+                } else {
                     $.ajax({
                         dataType: "json",
                         type: "GET",
index 97fd4ebb799ffba628789898be14274f7fc0357b..5d2fd682aadb326dcdd85034f58451e153ac89d3 100644 (file)
@@ -247,8 +247,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                 $("#learning_nav").hide();
                 $("#resetHistory").attr("disabled", true);
                 $("#errors-history").hide();
-            }
-            else {
+            } else {
                 ui.read_only = false;
                 $("#learning_nav").show();
                 $("#resetHistory").removeAttr("disabled", true);
@@ -293,8 +292,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                             $("#learning_nav").hide();
                             $("#resetHistory").attr("disabled", true);
                             $("#errors-history").hide();
-                        }
-                        else {
+                        } else {
                             ui.read_only = false;
                             $("#learning_nav").show();
                             $("#resetHistory").removeAttr("disabled", true);
@@ -332,16 +330,14 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
             success: function (data) {
                 if (on_success) {
                     on_success(data);
-                }
-                else {
+                } else {
                     alertMessage("alert-success", "Data saved");
                 }
             },
             error: function (jqXHR, textStatus, errorThrown) {
                 if (on_error) {
                     on_error("local", jqXHR, textStatus, errorThrown);
-                }
-                else {
+                } else {
                     alertMessage("alert-error", "Cannot receive data: " + errorThrown);
                 }
             }
@@ -412,8 +408,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                             if (neighbours_status.every(function (elt) { return elt.checked; })) {
                                 if (on_success) {
                                     on_success(neighbours_status);
-                                }
-                                else {
+                                } else {
                                     alertMessage("alert-success", "Request completed");
                                 }
                             }
@@ -424,8 +419,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                             if (on_error) {
                                 on_error(neighbours_status[ind],
                                     jqXHR, textStatus, errorThrown);
-                            }
-                            else {
+                            } else {
                                 alertMessage("alert-error", "Cannot receive data from " +
                                        neighbours_status[ind].host + ": " + errorThrown);
                             }
@@ -433,8 +427,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
                                 function (elt) { return elt.checked; })) {
                                 if (on_success) {
                                     on_success(neighbours_status);
-                                }
-                                else {
+                                } else {
                                     alertMessage("alert-success", "Request completed");
                                 }
                             }
index 65e6f27720e784f93b1156ac22f92da54261a71a..c419342000f54a57dbaa907f827d54fda4b41433 100644 (file)
@@ -126,8 +126,7 @@ define(["jquery", "d3pie", "humanize"],
                 if (checked_server === key) {
                     $("#clusterTable tbody [value=\"" + key + "\"]").prop("checked", true);
                     $("#selSrv [value=\"" + key + "\"]").prop("selected", true);
-                }
-                else if (!val.status) {
+                } else if (!val.status) {
                     $("#clusterTable tbody [value=\"" + key + "\"]").prop("disabled", true);
                     $("#selSrv [value=\"" + key + "\"]").prop("disabled", true);
                 }
index 71d57761740aeef7b0db1222efc0009bdda8df9c..237a10d6a83cbb9ef032a364d115b503a164c9c5 100644 (file)
@@ -52,8 +52,7 @@ define(["jquery", "footable"],
                     data: JSON.stringify(values),
                     dataType: "json",
                 });
-            }
-            else {
+            } else {
                 $.ajax({
                     data: JSON.stringify(values),
                     dataType: "json",
@@ -148,8 +147,7 @@ define(["jquery", "footable"],
 
                 if (exp > 0) {
                     item.frequency = item.frequency.toFixed(2) + "e-" + exp;
-                }
-                else {
+                } else {
                     item.frequency = item.frequency.toFixed(2);
                 }
             });
index 3fcfc3aaddb7d68bac3326d7620cf9799961ddc9..064cadc565ed1ece6897d0e78ecd789cc582a0ab 100644 (file)
@@ -96,19 +96,16 @@ define(["jquery"],
 
                         if (json.action === "clean" || "no action") {
                             action = "label-success";
-                        }
-                        else if (json.action === "rewrite subject" || "add header" || "probable spam") {
+                        } else if (json.action === "rewrite subject" || "add header" || "probable spam") {
                             action = "label-warning";
-                        }
-                        else if (json.action === "spam") {
+                        } else if (json.action === "spam") {
                             action = "label-danger";
                         }
 
                         var score = "";
                         if (json.score <= json.required_score) {
                             score = "label-success";
-                        }
-                        else if (json.score >= json.required_score) {
+                        } else if (json.score >= json.required_score) {
                             score = "label-danger";
                         }
                         $("<tbody id=\"tmpBody\"><tr>" +