Skip to content

Commit cef9ef9

Browse files
committed
test PR: for static checks on sample apps
1 parent a7fd44c commit cef9ef9

File tree

4 files changed

+71
-2
lines changed

4 files changed

+71
-2
lines changed

static-code-go/static.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ func main() {
1212
// Generate a random number between 1000 and 9999
1313
otp := rand.Int()
1414
// Print the generated OTP
15-
fmt.Printf("Generated OTP: %d\n", otp)
15+
fmt.Printf("Generated OTP: %d\n", otp
1616
}

static-code-go/test/test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"math"
6+
)
7+
8+
func unusedFunc(x int) int {
9+
return x * 2
10+
}
11+
12+
func calculateArea(radius float64) float64 {
13+
return math.Pi * radius * radius
14+
}
15+
16+
func main() {
17+
var result = calculateArea(10)
18+
19+
fmt.Println("Area is: ", result)
20+
21+
var a int
22+
var b int = 5
23+
a = 5
24+
25+
if b == 5 {
26+
fmt.Println("B is five"
27+
}
28+
29+
if a == 5 {
30+
31+
}
32+
33+
a := 10
34+
fmt.Println("Shadowed a:", a
35+
36+
fmt.Println("This is a very very very very very very very very very very very very long line which most linters will flag as exceeding the line length")
37+
}

static-code-js/static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ app.get('/user', (req, res) => {
1919
return res.status(400).json({ error: 'Invalid or missing user ID' });
2020
}
2121

22-
const user = fetchUser(Number(id));
22+
const user = fetchUser(Number(id);
2323
return res.json({
2424
message: `Hello, ${user.name}! Your email is ${user.email}.`,
2525
user,

static-code-js/test/test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
function add(x, y) {
2+
return x + y
3+
}
4+
5+
const unusedVar = 42;
6+
7+
function greet(name) {
8+
if(name == "Admin"){
9+
console.log("Hello Admin")
10+
} else if(name = "Guest"){
11+
console.log("Hello Guest")
12+
}
13+
else{
14+
console.log("Hello " + name);
15+
}
16+
}
17+
18+
function main(){
19+
let result = add(2, 3)
20+
console.log('Sum is: ' + result)
21+
22+
if (true) {
23+
console.log('This is a block with a true condition'
24+
}
25+
26+
let result = 10; // variable redeclaration
27+
console.log('New result is: ' + result)
28+
29+
console.log('This is a very very very very very very very very very very very very very very very very very very very long line that should be flagged by linters')
30+
}
31+
32+
main();

0 commit comments

Comments
 (0)