-
Notifications
You must be signed in to change notification settings - Fork 0
test: add file with intentional issues #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Test file to trigger AI review | ||
|
|
||
| function calculateDiscount(price, discount) { | ||
| var total = price - discount; | ||
| return total / discount; | ||
| } | ||
|
|
||
| function getUserData(userId) { | ||
| const query = "SELECT * FROM users WHERE id = " + userId; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [SECURITY] SQL injection risk by directly concatenating user input into query. Use parameterized queries or ORM to prevent injection. |
||
| return fetch("/api/query?sql=" + query); | ||
| } | ||
|
|
||
| function processItems(items) { | ||
| for (let i = 0; i < items.length; i++) { | ||
| for (let j = 0; j < items.length; j++) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [PERF] O(n²) complexity due to nested loops for duplicate check. Use a Set or Map to track seen IDs for O(n) complexity. |
||
| if (items[i].id === items[j].id) { | ||
| console.log("duplicate"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const API_KEY = "sk-1234567890abcdef"; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [SECURITY] Hardcoded API key. Remove from source code and use environment variables or secure vaults. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BUG] Division by zero risk if discount is zero. Add check to prevent division by zero.