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 aspie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// This file intentionally contains many issues for Codacy analysis

var foo = "bar"
function test(x, y) {
if(x = y) { // assignment instead of comparison

Check notice on line 5 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L5

Avoid assignments in operands

Check warning on line 5 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L5

Expected a conditional expression and instead saw an assignment.
console.log("Equal")
}
for(var i=0;i<10;i++) {
setTimeout(function() {
console.log(i) // closure issue, always prints 10
}, 100)
}
undeclaredVar = 5 // using undeclared variable

Check warning on line 13 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L13

'undeclaredVar' is not defined.
return x + y
}

test(1) // missing argument

// Unused variable
let unused = 123

Check warning on line 20 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L20

'unused' is assigned a value but never used.

Check warning on line 20 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L20

'unused' is assigned a value but never used.

// Bad indentation
function badIndent() {

Check warning on line 23 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L23

'badIndent' is defined but never used.

Check warning on line 23 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L23

'badIndent' is defined but never used.
console.log("bad indent")
}

// Unreachable code
function unreachable() {

Check warning on line 28 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L28

'unreachable' is defined but never used.

Check warning on line 28 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L28

'unreachable' is defined but never used.
return true
console.log("This will never run")

Check warning on line 30 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L30

Unreachable code.
}

// Deprecated API
document.write("deprecated")

// == instead of ===
if (foo == null) {
console.log("foo is null or undefined")
}

// Extra semicolons
;;;

Check notice on line 42 in aspie.js

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

aspie.js#L42

Unnecessary semicolon.

// Trailing spaces