]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Initialize variables at declaration
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 15 Sep 2018 15:09:47 +0000 (18:09 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 15 Sep 2018 15:09:47 +0000 (18:09 +0300)
.eslintrc.json
interface/js/app/config.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/stats.js
interface/js/app/upload.js

index 0d61454cabbfb480635d6786ecb925ae382140c9..b48d887dbe873fcb5b26fecc56dad4f00d48ec59 100644 (file)
@@ -60,7 +60,6 @@
         "function-paren-newline": "off",
         "global-require": "off",
         "guard-for-in": "off",
-        "init-declarations": "off",
         "key-spacing": "off",
         "line-comment-position": "off",
         "max-len": "off",
index 2f87525fa75fd1ec5fdd67bf05fcc44a7d5fa373..ee950f0231ba5d7f0af04921f38843a412ddf95f 100644 (file)
@@ -47,7 +47,7 @@ define(["jquery"],
                     var items = [];
                     $.each(data[0].data, function (i, item) {
                         var idx = -1;
-                        var label;
+                        var label = null;
                         if (item.action === "greylist") {
                             label = "Greylist";
                             idx = 0;
@@ -145,12 +145,9 @@ define(["jquery"],
                     var $tbody = $("<tbody>");
 
                     $.each(data, function (i, item) {
-                        var label;
-                        if ((item.editable === false || rspamd.read_only)) {
-                            label = "<span class=\"label label-default\">Read</span>";
-                        } else {
-                            label = "<span class=\"label label-default\">Read</span>&nbsp;<span class=\"label label-success\">Write</span>";
-                        }
+                        var label = ((item.editable === false || rspamd.read_only))
+                            ? "<span class=\"label label-default\">Read</span>"
+                            : "<span class=\"label label-default\">Read</span>&nbsp;<span class=\"label label-success\">Write</span>";
                         var $tr = $("<tr>");
                         $("<td class=\"col-md-2 maps-cell\">" + label + "</td>").appendTo($tr);
                         var $span = $("<span class=\"map-link\" data-toggle=\"modal\" data-target=\"#modalDialog\">" + item.uri + "</span>").data("item", item);
index 48f2220fe643f04a479c3a95d24688542443ae1b..16d4b49d27d0f38317c96a0a9130f4cbe6f854c6 100644 (file)
@@ -30,7 +30,7 @@ define(["jquery", "footable", "humanize"],
         var rows_per_page = 25;
 
         var ui = {};
-        var prevVersion;
+        var prevVersion = null;
         var htmlEscapes = {
             "&": "&amp;",
             "<": "&lt;",
@@ -99,12 +99,9 @@ define(["jquery", "footable", "humanize"],
                 item.action = "<div style='font-size:11px' class='label label-info'>" + item.action + "</div>";
             }
 
-            var score_content;
-            if (item.score < item.required_score) {
-                score_content = "<span class='text-success'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>";
-            } else {
-                score_content = "<span class='text-danger'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>";
-            }
+            var score_content = (item.score < item.required_score)
+                ? "<span class='text-success'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>"
+                : "<span class='text-danger'>" + item.score.toFixed(2) + " / " + item.required_score + "</span>";
 
             item.score = {
                 options: {
@@ -159,7 +156,7 @@ define(["jquery", "footable", "humanize"],
 
                     preprocess_item(item);
                     Object.keys(item.symbols).map(function (key) {
-                        var str;
+                        var str = null;
                         var sym = item.symbols[key];
 
                         if (sym.description) {
index 5ade66ce49e7eaf2bcc13c6893436cebeab9784d..1e41afaaf29b0b6e6ae0f01b9dc08a6be70b1536 100644 (file)
@@ -38,7 +38,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config,
     var checked_server = "All SERVERS";
     var ui = {};
     var timer_id = [];
-    var selData; // Graph's dataset selector state
+    var selData = null; // Graph's dataset selector state
 
     NProgress.configure({
         minimum: 0.01,
index ea8edfd8a0d7aad408dd8f2ad879dc5cd495f11b..51e41d7888313a78ad3e70271170d240d46966d5 100644 (file)
@@ -34,7 +34,7 @@ define(["jquery", "d3pie", "humanize"],
             var hours = seconds % 31536000 % 2628000 % 86400 / 3600 >> 0;
             var minutes = seconds % 31536000 % 2628000 % 86400 % 3600 / 60 >> 0;
             /* eslint-enable no-bitwise */
-            var out;
+            var out = null;
             if (years > 0) {
                 if (months > 0) {
                     out = years + "yr " + months + "mth";
index e542667a60413370c1adf29975de243202a51da6..927501248e23d9c7934cbd1c5e1e959533520e46 100644 (file)
@@ -33,7 +33,7 @@ define(["jquery"],
 
         // @upload text
         function uploadText(rspamd, data, source, headers) {
-            var url;
+            var url = null;
             if (source === "spam") {
                 url = "learnspam";
             } else if (source === "ham") {