From: Alexander Moisseev Date: Sun, 15 Jul 2018 14:26:12 +0000 (+0300) Subject: [Minor] Use consistent brace style for blocks (1tbs) X-Git-Tag: 1.7.9~117^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ab72e301244e22f10463bfbf744ad95da4f7e9f9;p=rspamd.git [Minor] Use consistent brace style for blocks (1tbs) --- diff --git a/.eslintrc.json b/.eslintrc.json index 3e52ed7f8..d62daffcf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -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", diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index c7e0041ea..bb6431056 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -241,8 +241,7 @@ define(["jquery", "d3evolution", "footable"], }); updateWidgets(data); }); - } - else { + } else { updateWidgets(neighbours_data[0]); } }, diff --git a/interface/js/app/history.js b/interface/js/app/history.js index def170334..bfbc83874 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -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", diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 97fd4ebb7..5d2fd682a 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -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"); } } diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index 65e6f2772..c41934200 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -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); } diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index 71d577617..237a10d6a 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -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); } }); diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index 3fcfc3aad..064cadc56 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -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"; } $("" +