]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Enforce consistent key-value spacing 2487/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 16 Sep 2018 16:31:14 +0000 (19:31 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 16 Sep 2018 16:31:14 +0000 (19:31 +0300)
.eslintrc.json
interface/js/app/config.js
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
interface/js/main.js

index b04b72b4bf19b1bd43ae186b7443e20df6f4c240..fd33c6de2752861e1e3055f0ac4e0334d0a61170 100644 (file)
@@ -19,6 +19,9 @@
         "id-length": ["error", { "min": 1 }],
         "indent": ["error", 4, { "SwitchCase": 1 }],
         // "max-len": ["error", { "code": 120 }],
+        "key-spacing": ["error", {
+            "singleLine": { "afterColon": false }
+        }],
         "max-params": ["warn", 6],
         "max-statements": ["warn", 28],
         "max-statements-per-line": ["error", { "max": 2 }],
@@ -58,7 +61,6 @@
         "func-style": "off",
         "function-paren-newline": "off",
         "guard-for-in": "off",
-        "key-spacing": "off",
         "line-comment-position": "off",
         "max-len": "off",
         "max-lines": "off",
index ee950f0231ba5d7f0af04921f38843a412ddf95f..58132dc41de9906de3b7fb5f04d749129b41e36c 100644 (file)
@@ -193,7 +193,7 @@ define(["jquery"],
                         $("#modalTitle").html(item.uri);
                         $("#" + item.map).first().show();
                         $("#modalDialog .progress").hide();
-                        $("#modalDialog").modal({backdrop: true, keyboard: "show", show: true});
+                        $("#modalDialog").modal({backdrop:true, keyboard:"show", show:true});
                         if (item.editable === false) {
                             $("#modalSave").hide();
                             $("#modalSaveAll").hide();
@@ -227,7 +227,7 @@ define(["jquery"],
                     headers: {
                         Map: id,
                     },
-                    params:{
+                    params: {
                         data: data,
                         dataType: "text",
                     },
index 9776fef0fff9cb083a6f74d4d8831420d8d394f1..319ccda9e8f425b259ccab34a35f876e009c1d1d 100644 (file)
@@ -94,10 +94,10 @@ define(["jquery", "d3evolution", "footable"],
 
         function initGraph() {
             var graph = new D3Evolution("graph", $.extend({}, graph_options, {
-                yScale:      getSelector("selYScale"),
-                type:        getSelector("selType"),
+                yScale: getSelector("selYScale"),
+                type: getSelector("selType"),
                 interpolate: getSelector("selInterpolate"),
-                convert:     getSelector("selConvert"),
+                convert: getSelector("selConvert"),
             }));
             $("#selYScale").change(function () {
                 graph.yScale(this.value);
@@ -144,12 +144,12 @@ define(["jquery", "d3evolution", "footable"],
                     enabled: true
                 },
                 columns: [
-                    {name: "label", title: "Action"},
-                    {name: "value", title: "Messages", defaultContent: ""},
-                    {name: "min", title: "Minimum, <span class=\"unit\">" + unit + "</span>", defaultContent: ""},
-                    {name: "avg", title: "Average, <span class=\"unit\">" + unit + "</span>", defaultContent: ""},
-                    {name: "max", title: "Maximum, <span class=\"unit\">" + unit + "</span>", defaultContent: ""},
-                    {name: "last", title: "Last, " + unit},
+                    {name:"label", title:"Action"},
+                    {name:"value", title:"Messages", defaultContent:""},
+                    {name:"min", title:"Minimum, <span class=\"unit\">" + unit + "</span>", defaultContent:""},
+                    {name:"avg", title:"Average, <span class=\"unit\">" + unit + "</span>", defaultContent:""},
+                    {name:"max", title:"Maximum, <span class=\"unit\">" + unit + "</span>", defaultContent:""},
+                    {name:"last", title:"Last, " + unit},
                 ],
                 rows: rows
             });
@@ -257,7 +257,7 @@ define(["jquery", "d3evolution", "footable"],
                 },
                 errorMessage: "Cannot receive throughput data",
                 errorOnceId: "alerted_graph_",
-                data: {type: type}
+                data: {type:type}
             });
         };
 
index 990f60a093031119933524edd95fe7e1a5cccbe5..21a6edfc0ef2cec972c2495a03da1494a862e76e 100644 (file)
@@ -151,7 +151,7 @@ define(["jquery", "footable", "humanize"],
                             full += item.rcpt_mime.join(", ");
                             shrt += item.rcpt_mime.slice(0, rcpt_lim).join(",&#8203;") + more("rcpt_mime");
                         }
-                        return {full: full, shrt: shrt};
+                        return {full:full, shrt:shrt};
                     }
 
                     preprocess_item(item);
@@ -511,36 +511,36 @@ define(["jquery", "footable", "humanize"],
 
         function initHistoryTable(rspamd, tables, data, items) {
             FooTable.actionFilter = FooTable.Filtering.extend({
-                construct : function (instance) {
+                construct: function (instance) {
                     this._super(instance);
                     this.actions = ["reject", "add header", "greylist",
                         "no action", "soft reject", "rewrite subject"];
                     this.def = "Any action";
                     this.$action = null;
                 },
-                $create : function () {
+                $create: function () {
                     this._super();
                     var self = this, $form_grp = $("<div/>", {
-                        class : "form-group"
+                        class: "form-group"
                     }).append($("<label/>", {
-                        class : "sr-only",
-                        text : "Action"
+                        class: "sr-only",
+                        text: "Action"
                     })).prependTo(self.$form);
 
                     self.$action = $("<select/>", {
-                        class : "form-control"
+                        class: "form-control"
                     }).on("change", {
-                        self : self
+                        self: self
                     }, self._onStatusDropdownChanged).append(
                         $("<option/>", {
-                            text : self.def
+                            text: self.def
                         })).appendTo($form_grp);
 
                     $.each(self.actions, function (i, action) {
                         self.$action.append($("<option/>").text(action));
                     });
                 },
-                _onStatusDropdownChanged : function (e) {
+                _onStatusDropdownChanged: function (e) {
                     var self = e.data.self, selected = $(this).val();
                     if (selected !== self.def) {
                         if (selected === "reject") {
@@ -553,7 +553,7 @@ define(["jquery", "footable", "humanize"],
                     }
                     self.filter();
                 },
-                draw : function () {
+                draw: function () {
                     this._super();
                     var action = this.find("action");
                     if (action instanceof FooTable.Filter) {
@@ -705,7 +705,7 @@ define(["jquery", "footable", "humanize"],
         function initErrorsTable(tables, rows) {
             tables.errors = FooTable.init("#errorsLog", {
                 columns: [
-                    {sorted: true, direction: "DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}},
+                    {sorted:true, direction:"DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}},
                     {name:"type", title:"Worker type", breakpoints:"xs sm", style:{"font-size":"11px", "width":150, "maxWidth":150}},
                     {name:"pid", title:"PID", breakpoints:"xs sm", style:{"font-size":"11px", "width":110, "maxWidth":110}},
                     {name:"module", title:"Module", style:{"font-size":"11px"}},
index e7b86a9c269d18a7eb9a75443eb1e01ef5ff87f4..ecd82aad5b9977ffc7081b2dbb4dd295db14a61d 100644 (file)
@@ -182,7 +182,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config,
         var req_params = {
             jsonp: false,
             data: o.data,
-            headers: $.extend({Password: getPassword()}, o.headers),
+            headers: $.extend({Password:getPassword()}, o.headers),
             url: neighbours_status[ind].url + req_url,
             xhr: function () {
                 var xhr = $.ajaxSettings.xhr();
@@ -483,7 +483,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config,
                     var data = json[0].data;
                     if (jQuery.isEmptyObject(data)) {
                         neighbours = {
-                            local:  {
+                            local: {
                                 host: window.location.host,
                                 url: window.location.href
                             }
@@ -509,7 +509,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config,
             if (o.server !== "local") {
                 neighbours_status = [{
                     name: o.server,
-                    host:  neighbours[o.server].host,
+                    host: neighbours[o.server].host,
                     url: neighbours[o.server].url,
                 }];
             }
index 51e41d7888313a78ad3e70271170d240d46966d5..e9f0b8f2d3582b6f1d53f40dcc3bc1588922cdfa 100644 (file)
@@ -139,30 +139,30 @@ define(["jquery", "d3pie", "humanize"],
             if (creds && creds[checked_server]) {
                 var data = creds[checked_server].data;
                 var new_data = [{
-                    color : "#66CC00",
-                    label : "Clean",
-                    data : data.clean,
-                    value : data.clean
+                    color: "#66CC00",
+                    label: "Clean",
+                    data: data.clean,
+                    value: data.clean
                 }, {
-                    color : "#BF8040",
-                    label : "Temporarily rejected",
-                    data : data.soft_reject,
-                    value : data.soft_reject
+                    color: "#BF8040",
+                    label: "Temporarily rejected",
+                    data: data.soft_reject,
+                    value: data.soft_reject
                 }, {
-                    color : "#FFAD00",
-                    label : "Probable spam",
-                    data : data.probable,
-                    value : data.probable
+                    color: "#FFAD00",
+                    label: "Probable spam",
+                    data: data.probable,
+                    value: data.probable
                 }, {
-                    color : "#436EEE",
-                    label : "Greylisted",
-                    data : data.greylist,
-                    value : data.greylist
+                    color: "#436EEE",
+                    label: "Greylisted",
+                    data: data.greylist,
+                    value: data.greylist
                 }, {
-                    color : "#FF0000",
-                    label : "Rejected",
-                    data : data.reject,
-                    value : data.reject
+                    color: "#FF0000",
+                    label: "Rejected",
+                    data: data.reject,
+                    value: data.reject
                 }];
 
                 return rspamd.drawPie(pie, "chart", new_data);
index a7d55902e02259a7a483bb68017028789152b4f6..4902efd172056d4051a2284128e84a4264ffbd53 100644 (file)
@@ -149,35 +149,35 @@ define(["jquery", "footable"],
                     var data = json[0].data;
                     var items = process_symbols_data(data);
                     FooTable.groupFilter = FooTable.Filtering.extend({
-                        construct : function (instance) {
+                        construct: function (instance) {
                             this._super(instance);
                             this.groups = items[1];
                             this.def = "Any group";
                             this.$group = null;
                         },
-                        $create : function () {
+                        $create: function () {
                             this._super();
                             var self = this, $form_grp = $("<div/>", {
-                                class : "form-group"
+                                class: "form-group"
                             }).append($("<label/>", {
-                                class : "sr-only",
-                                text : "Group"
+                                class: "sr-only",
+                                text: "Group"
                             })).prependTo(self.$form);
 
                             self.$group = $("<select/>", {
-                                class : "form-control"
+                                class: "form-control"
                             }).on("change", {
-                                self : self
+                                self: self
                             }, self._onStatusDropdownChanged).append(
                                 $("<option/>", {
-                                    text : self.def
+                                    text: self.def
                                 })).appendTo($form_grp);
 
                             $.each(self.groups, function (i, group) {
                                 self.$group.append($("<option/>").text(group));
                             });
                         },
-                        _onStatusDropdownChanged : function (e) {
+                        _onStatusDropdownChanged: function (e) {
                             var self = e.data.self, selected = $(this).val();
                             if (selected !== self.def) {
                                 self.addFilter("group", selected, ["group"]);
@@ -186,7 +186,7 @@ define(["jquery", "footable"],
                             }
                             self.filter();
                         },
-                        draw : function () {
+                        draw: function () {
                             this._super();
                             var group = this.find("group");
                             if (group instanceof FooTable.Filter) {
@@ -198,11 +198,11 @@ define(["jquery", "footable"],
                     });
                     tables.symbols = FooTable.init("#symbolsTable", {
                         columns: [
-                            {sorted: true, direction: "ASC", name:"group", title:"Group", style:{"font-size":"11px"}},
+                            {sorted:true, direction:"ASC", name:"group", title:"Group", style:{"font-size":"11px"}},
                             {name:"symbol", title:"Symbol", style:{"font-size":"11px"}},
                             {name:"description", title:"Description", breakpoints:"xs sm", style:{"font-size":"11px"}},
                             {name:"weight", title:"Score", style:{"font-size":"11px"}},
-                            {name:"frequency", title:"Frequency", breakpoints:"xs sm", style:{"font-size":"11px"}, sortValue: function (value) { return Number(value).toFixed(2); }},
+                            {name:"frequency", title:"Frequency", breakpoints:"xs sm", style:{"font-size":"11px"}, sortValue:function (value) { return Number(value).toFixed(2); }},
                             {name:"time", title:"Avg. time", breakpoints:"xs sm", style:{"font-size":"11px"}},
                             {name:"save", title:"Save", style:{"font-size":"11px"}},
                         ],
index 927501248e23d9c7934cbd1c5e1e959533520e46..94659b7403d0e7e2042d844cc92abe0e1a03d0ef 100644 (file)
@@ -161,7 +161,7 @@ define(["jquery"],
                 $("#scanTextSource").val("");
                 $("#scanResult").hide();
                 $("#scanOutput tbody").remove();
-                $("html, body").animate({scrollTop: 0}, 1000);
+                $("html, body").animate({scrollTop:0}, 1000);
                 return false;
             });
             // @init upload
index db9c52942a0506919428f74f9847134aaf42b4c6..0c48d95f55aac967914e0af85c7a58d7ea38c10d 100644 (file)
@@ -15,10 +15,10 @@ requirejs.config({
         nprogress: "nprogress.min",
     },
     shim: {
-        bootstrap: {exports: "bootstrap", deps: ["jquery"]},
-        d3pie: {exports: "d3pie", deps: ["d3.global", "jquery"]},
-        d3evolution: {exports: "D3Evolution", deps: ["d3", "jquery"]},
-        footable: {deps: ["bootstrap", "jquery"]}
+        bootstrap: {exports:"bootstrap", deps:["jquery"]},
+        d3pie: {exports:"d3pie", deps:["d3.global", "jquery"]},
+        d3evolution: {exports:"D3Evolution", deps:["d3", "jquery"]},
+        footable: {deps:["bootstrap", "jquery"]}
     }
 });