Fixed or disabled warnings

This commit is contained in:
baldo 2017-05-06 17:31:34 +02:00
parent 94a51921fd
commit 3d6fb5feec
11 changed files with 45 additions and 38 deletions

View file

@ -21,7 +21,9 @@ angular.module('ffffng')
return _.template(fs.readFileSync(snippetFile).toString())(deepExtend(
{},
// jshint -W040
this, // parent data
// jshint +W040
data,
templateFunctions
));
@ -30,7 +32,7 @@ angular.module('ffffng')
function snippet(name) {
return function (data) {
return renderSnippet.bind(this)(name, data);
}
};
}
function renderLink(href, text) {
@ -76,7 +78,7 @@ angular.module('ffffng')
},
render: function (mailOptions, callback) {
var templatePathPrefix = templateBasePath + '/' + mailOptions.email
var templatePathPrefix = templateBasePath + '/' + mailOptions.email;
async.parallel({
subject: _.partial(fs.readFile, templatePathPrefix + '.subject.txt'),

View file

@ -65,7 +65,9 @@ angular.module('ffffng')
.tag('monitoring', 'information-retrieval')
.debug('Node is known in monitoring: %s', nodeData.mac);
// jshint -W106
if (!moment(row.import_timestamp).isBefore(nodeData.importTimestamp)) {
// jshint +W106
Logger
.tag('monitoring', 'information-retrieval')
.debug('No new data for node, skipping: %s', nodeData.mac);
@ -108,7 +110,9 @@ angular.module('ffffng')
nodeDataForStoring = {
mac: node.mac,
state: 'OFFLINE',
// jshint -W106
lastSeen: _.isUndefined(row) ? moment() : moment.unix(row.last_seen),
// jshint +W106
importTimestamp: moment()
};
} else {
@ -129,7 +133,7 @@ angular.module('ffffng')
Logger.tag('monitoring', 'information-retrieval').debug('Parsing nodes.json...');
function parseTimestamp(timestamp) {
if (!_.isString(json.timestamp)) {
if (!_.isString(timestamp)) {
return moment.invalid();
}
return moment.utc(timestamp);
@ -277,7 +281,9 @@ angular.module('ffffng')
mailType,
{
node: node,
// jshint -W106
lastSeen: nodeState.last_seen,
// jshint +W106
disableUrl: UrlBuilder.monitoringDisableUrl(nodeSecrets)
},
@ -361,9 +367,7 @@ angular.module('ffffng')
* descriptive string that stores, which was the last mail type, stored in the database as last_status_mail_type
*/
var previousType =
mailNumber === 1
? 'monitoring-online-again'
: ('monitoring-offline-' + (mailNumber - 1));
mailNumber === 1 ? 'monitoring-online-again' : ('monitoring-offline-' + (mailNumber - 1));
// the first time the first offline mail is send, there was no mail before
var allowNull = mailNumber === 1 ? ' OR last_status_mail_type IS NULL' : '';
@ -773,5 +777,5 @@ angular.module('ffffng')
}
);
}
}
};
});

View file

@ -206,7 +206,7 @@ angular.module('ffffng')
function deleteNodeFile(token, callback) {
findNodeFiles({ token: token }, function (err, files) {
if (err) {
Logger.tag('node', 'delete').error('Could not find node file: ' + file, error);
Logger.tag('node', 'delete').error('Could not find node file: ' + files, err);
return callback({data: 'Could not delete node.', type: ErrorTypes.internalError});
}
@ -218,7 +218,7 @@ angular.module('ffffng')
fs.unlinkSync(files[0]);
}
catch (error) {
Logger.tag('node', 'delete').error('Could not delete node file: ' + file, error);
Logger.tag('node', 'delete').error('Could not delete node file: ' + files, error);
return callback({data: 'Could not delete node.', type: ErrorTypes.internalError});
}
@ -256,8 +256,8 @@ angular.module('ffffng')
_.each(entries, function (value, key) {
if (key === 'mac') {
node['mac'] = value;
node['mapId'] = _.toLower(value).replace(/:/g, '')
node.mac = value;
node.mapId = _.toLower(value).replace(/:/g, '');
} else if (key === 'monitoring') {
var active = value === 'aktiv';
var pending = value === 'pending';
@ -320,7 +320,7 @@ angular.module('ffffng')
},
function (err) {
if (err) {
Logger.tag('monitoring', 'confirmation').error('Could not enqueue confirmation mail.', error);
Logger.tag('monitoring', 'confirmation').error('Could not enqueue confirmation mail.', err);
return callback({data: 'Internal error.', type: ErrorTypes.internalError});
}
@ -377,7 +377,7 @@ angular.module('ffffng')
} else {
// monitoring is still enabled
if (currentNode.email != node.email) {
if (currentNode.email !== node.email) {
// new email so we need a new token and a reconfirmation
monitoringConfirmed = false;
monitoringToken = generateToken();
@ -528,7 +528,7 @@ angular.module('ffffng')
});
callback(null, nodeStatistics);
})
});
}
};
});