Fixes following code smell reported by SonarQube:

1) Replace this if-then-else flow by a single return statement
 2) Remove the unnecessary boolean literals.
This commit is contained in:
Akshay Joshi
2022-09-08 19:56:02 +05:30
parent 7086719640
commit b8f63adf41
47 changed files with 193 additions and 598 deletions

View File

@@ -337,11 +337,8 @@ define([
return false;
}
if ('validate' in self && _.isFunction(self.validate) &&
_.isString(self.validate.apply(self))) {
return false;
}
return true;
return !('validate' in self && _.isFunction(self.validate) &&
_.isString(self.validate.apply(self)));
},
set: function(key, val, options) {
let opts = _.isObject(key) ? val : options;
@@ -445,7 +442,7 @@ define([
let self = this,
res, isNew = self.isNew();
session = (typeof(session) != 'undefined' && session == true);
session = (typeof(session) != 'undefined' && session);
if (!session || isNew) {
res = Backbone.Model.prototype.toJSON.call(this, arguments);
@@ -1040,7 +1037,7 @@ define([
*/
toJSON: function(session) {
let self = this;
session = (typeof(session) != 'undefined' && session == true);
session = (typeof(session) != 'undefined' && session);
if (!session) {
return Backbone.Collection.prototype.toJSON.call(self);