Skip to content
Open
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
44 changes: 44 additions & 0 deletions codequality.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,47 @@ function anotherAssignmentCondition(values) {
}
}
}
function f1(a, b) {

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

Choose a reason for hiding this comment

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

Long functions are difficult to understand, test, and maintain. More info

Choose a reason for hiding this comment

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

Functions without comments are hard to understand for other developers. More info

let x = a + b;
for (let i = 0; i < 100; i++) {
x += i;
if (i % 10 === 0) {
x += Math.sqrt(i);
}
for (let j = 0; j < 5; j++) {
x += j * i;
}
}
let y = 0;
for (let k = 0; k < 50; k++) {
y += k;
if (y % 3 === 0) {
y -= k;
}
}
console.log("Result is: " + (x + y));

Choose a reason for hiding this comment

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

Lines that are too long are difficult to read and navigate, especially on smaller screens. More info

return x + y;
}

class C {

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

Choose a reason for hiding this comment

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

Functions without comments are hard to understand for other developers. More info

constructor(d) {

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

this.d = d;

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

}

doIt() {

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

Choose a reason for hiding this comment

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

Functions without comments are hard to understand for other developers. More info

let r = 0;

Choose a reason for hiding this comment

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

Generic or short names make code hard to understand. More info

Choose a reason for hiding this comment

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

Very short variable names make code unclear. More info

for (let i = 0; i < this.d.length; i++) {
if (this.d[i]) {
r += this.d[i] * 2;
if (this.d[i] > 100) {
r += this.d[i] / 2;
}
for (let j = 0; j < 10; j++) {
r += j;
}
}
}
console.log("Done doing it: " + r);
return r;
}
}