Skip to content

Commit 8d2156f

Browse files
author
Lionel Bijaoui
committed
Improve Codacy score
1 parent 73720f4 commit 8d2156f

File tree

3 files changed

+34
-13
lines changed

3 files changed

+34
-13
lines changed

projects/full/app.vue

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ export default {
8484
8585
computed: {
8686
validationErrors() {
87-
if (this.$refs.form && this.$refs.form.errors) return this.$refs.form.errors;
87+
if (this.$refs.form && this.$refs.form.errors) {
88+
return this.$refs.form.errors;
89+
}
8890
8991
return [];
9092
}
@@ -187,7 +189,9 @@ export default {
187189
let id = 0;
188190
189191
each(this.rows, (row) => {
190-
if (row.id > id) id = row.id;
192+
if (row.id > id) {
193+
id = row.id;
194+
}
191195
});
192196
193197
return ++id;
@@ -206,8 +210,12 @@ export default {
206210
getLocation(model) {
207211
if (navigator.geolocation) {
208212
navigator.geolocation.getCurrentPosition((pos) => {
209-
if (!model.address) model.address = {};
210-
if (!model.address.geo) model.address.geo = {};
213+
if (!model.address) {
214+
model.address = {};
215+
}
216+
if (!model.address.geo) {
217+
model.address.geo = {};
218+
}
211219
model.address.geo.latitude = pos.coords.latitude.toFixed(5);
212220
model.address.geo.longitude = pos.coords.longitude.toFixed(5);
213221
});

projects/full/data.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import fecha from "fecha";
33

44
let fakerator = new Fakerator();
55

6-
let roles = [{ id: "admin", name: "Administrator" }, { id: "moderator", name: "Moderator" }, { id: "user", name: "Registered User" }, { id: "visitor", name: "Visitor" }];
6+
let roles = [
7+
{ id: "admin", name: "Administrator" },
8+
{ id: "moderator", name: "Moderator" },
9+
{ id: "user", name: "Registered User" },
10+
{ id: "visitor", name: "Visitor" }
11+
];
712

813
let skills = ["HTML5", "Javascript", "CSS3", "CoffeeScript", "AngularJS", "ReactJS", "VueJS"];
914

@@ -34,7 +39,9 @@ let users = (function() {
3439
user.favoriteColor = "#" + fakerator.internet.color();
3540
user.color = "#" + fakerator.internet.color();
3641

37-
if (user.type === "business") user.company = fakerator.entity.company();
42+
if (user.type === "business") {
43+
user.company = fakerator.entity.company();
44+
}
3845

3946
user.income = [fakerator.random.number(50000), fakerator.random.number(50000, 100000)];
4047

projects/full/schema.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export default {
5151
console.log(`Model's name changed from ${oldVal} to ${newVal}. Model:`, model);
5252
},
5353
onValidated(model, errors) {
54-
if (errors.length > 0) console.warn("Validation error in Name field! Errors:", errors);
54+
if (errors.length > 0) {
55+
console.warn("Validation error in Name field! Errors:", errors);
56+
}
5557
}
5658
},
5759
{
@@ -434,25 +436,29 @@ export default {
434436
let values = val.split(",");
435437
if (!model.address) model.address = {};
436438
if (!model.address.geo) model.address.geo = {};
437-
if (values.length > 0 && values[0].trim() !== "")
439+
if (values.length > 0 && values[0].trim() !== "") {
438440
model.address.geo.latitude = parseFloat(values[0].trim());
439-
else model.address.geo.latitude = 0;
440-
if (values.length > 1 && values[1].trim() !== "")
441+
} else {
442+
model.address.geo.latitude = 0;
443+
}
444+
if (values.length > 1 && values[1].trim() !== "") {
441445
model.address.geo.longitude = parseFloat(values[1].trim());
442-
else model.address.geo.longitude = 0;
446+
} else {
447+
model.address.geo.longitude = 0;
448+
}
443449
},
444450
buttons: [
445451
{
446452
classes: "btn-location",
447453
label: "Current location",
448-
onclick: function(model) {
454+
onclick(model) {
449455
return this.$parent.getLocation(model);
450456
}
451457
},
452458
{
453459
classes: "btn-clear",
454460
label: "Clear",
455-
onclick: function(model) {
461+
onclick(model) {
456462
model.address.geo = {
457463
latitude: 0,
458464
longitude: 0

0 commit comments

Comments
 (0)