Skip to content
Closed
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
2 changes: 1 addition & 1 deletion static-code-go/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ func main() {
// Generate a random number between 1000 and 9999
otp := rand.Int()
// Print the generated OTP
fmt.Printf("Generated OTP: %d\n", otp)
fmt.Printf("Generated OTP: %d\n", otp
}
37 changes: 37 additions & 0 deletions static-code-go/test/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package main

import (
"fmt"
"math"
)

func unusedFunc(x int) int {
return x * 2
}

func calculateArea(radius float64) float64 {
return math.Pi * radius * radius
}

func main() {
var result = calculateArea(10)

fmt.Println("Area is: ", result)

var a int
var b int = 5
a = 5

if b == 5 {
fmt.Println("B is five"
}

if a == 5 {

}

a := 10
fmt.Println("Shadowed a:", a

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")
}
2 changes: 1 addition & 1 deletion static-code-js/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app.get('/user', (req, res) => {
return res.status(400).json({ error: 'Invalid or missing user ID' });
}

const user = fetchUser(Number(id));
const user = fetchUser(Number(id);
return res.json({
message: `Hello, ${user.name}! Your email is ${user.email}.`,
user,
Expand Down
32 changes: 32 additions & 0 deletions static-code-js/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
function add(x, y) {
return x + y
}

const unusedVar = 42;

function greet(name) {
if(name == "Admin"){
console.log("Hello Admin")
} else if(name = "Guest"){
console.log("Hello Guest")
}
else{
console.log("Hello " + name);
}
}

function main(){
let result = add(2, 3)
console.log('Sum is: ' + result)

if (true) {
console.log('This is a block with a true condition'
}

let result = 10; // variable redeclaration
console.log('New result is: ' + result)

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')
}

main();
Loading