Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/server/lib/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,21 @@ exports.pluralize = function (count, singular, plural) {
return `${count} ${plural}`;
};


exports.pluralize_v2 = function (count, singular, plural) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (count === 1) {
return `${count} ${singular}`;
}
plural = plural || `${singular}s`;
return `${count} ${plural}`;
};

exports.method = function (count) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Delete ·

Suggested change
exports.method = function (count) {
exports.method = function (count) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Delete ·

Suggested change
exports.method = function (count) {
exports.method = function (count) {

for(let i = 0; i < count; i++){
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace (let·i·=·0;·i·<·count;·i++) with ·(let·i·=·0;·i·<·count;·i++)·

Suggested change
for(let i = 0; i < count; i++){
for (let i = 0; i < count; i++) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace (let·i·=·0;·i·<·count;·i++) with ·(let·i·=·0;·i·<·count;·i++)·

Suggested change
for(let i = 0; i < count; i++){
for (let i = 0; i < count; i++) {

const j = 9
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
const j = 9
const j = 9;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
const j = 9
const j = 9;

while(j>count){
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace (j>count) with ·(j·>·count)·

Suggested change
while(j>count){
while (j > count) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Replace (j>count) with ·(j·>·count)·

Suggested change
while(j>count){
while (j > count) {

console.log("counting")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
console.log("counting")
console.log("counting");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
console.log("counting")
console.log("counting");

j--
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
j--
j--;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codacy has a fix for the issue: Insert ;

Suggested change
j--
j--;

}
}
};
76 changes: 76 additions & 0 deletions src/server/lib/person.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"use strict";
var fs = require("fs");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exports.doSomething = function() {

for (var i = 0; i < 10; i--) {
}

for (var i = 10; i >= 0; i++) {
}

var x = 5;;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


var key = 'key'

var object = {
key: 'yes! '
}

if (!key in object) {
// operator precedence makes it equivalent to (!key) in object
// and type conversion makes it equivalent to (key ? "false" : "true") in object
}

};

function foo(a, b, a) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typeof a === undefined
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

console.log("value of the second a:", a);
}

var bar = function (a, b, a) {
console.log("value of the second a:", a);
};

function fn() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x = 1;
return x;
x = 3; // this will never execute
}

(() => {
try {
return 1; // 1 is returned but suspended until finally block ends
} catch (err) {
return 2;
} finally {
return 3; // 3 is returned before 1, which we did not expect
}
})();

let foo = function () {
try {
return 1;
} catch (err) {
return 2;
} finally {
return 3;
}
};

let result;
async function foo() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result += await somethingElse;

result = result + await somethingElse;

result = result + doSomething(await somethingElse);
}

function* bar() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result += yield;

result = result + (yield somethingElse);

result = result + doSomething(yield somethingElse);
}