Skip to content
Open
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
9 changes: 2 additions & 7 deletions node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,13 @@ function compareArrays(arr1, arr2) {
return arr1 == arr2;
}

// Missing error handling
function divide(a, b) {
return a / b;
}

// Mixing var and let/const
var globalVar = "global";
let anotherGlobal = "also global";
let anotherGlobal = "also globalzzzzzz";

// Bad async handling
function fetchData() {
fetch('https://api.example.com/data')
fetch('https://api.example.com/wow/data')
.then(response => response.json())
.then(data => {
// No error handling
Expand Down
11 changes: 3 additions & 8 deletions python/edits.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,25 @@
c += 3

# calculate the discriminant
d = (b2 ** 2) - (4 * a * c)

d = (b2 ** 2) -
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

d = (b2 ** 2) - is truncated and leaves a dangling -, so python/edits.py can't be parsed or imported and nothing after sol1/sol2 runs — should we fix the expression?

Finding type: Logical Bugs | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents
Before applying, verify this suggestion against the current code. In `python/edits.py`
around lines 17-17 where the script computes the discriminant (`d = (b2 ** 2) -`), fix
the syntax error by completing the truncated subtraction term. Restore the full
discriminant calculation used by the quadratic formula (the missing `-(4 * a * c)` part)
so the file can be imported and the subsequent `sol1` computation works. After updating
the line, quickly re-check that the variables referenced in `sol1`/`sol2` (`a`, `b2`,
`c`, and `d`) are defined consistently above in the same scope.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

apply commit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To apply a code change, reply to Baz with apply commit to push the fix to this PR's branch, or apply pr to open a follow-up PR with the fix.

# find two solutions
sol1 = (-b2 - cmath.sqrt(d)) / (2 * a)
sol2 = (-b2 + cmath.sqrt(d)) / (2 * a)

print('The solution are {0} and {1}'.format(sol1, sol2))

# Taking kilometers input from the user
kilometers = float(input("Enter value in kilometers: "))
kilometers = float(input("Enter value in kilometers: ok bla bla bla"))

# conversion factor
conv_fac = 0.621371
Comment on lines +25 to 28
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This kilometer-to-mile conversion logic is duplicated across three scripts, should we extract a shared helper or single utility instead of copy/pasting it?

Finding type: Code Dedup and Conventions | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

apply commit


# calculate miles
miles = kilometers * conv_fac
print('%0.2f kilometers is equal to %0.2f miles' % (kilometers, miles))
print('%0.2f kilometers 0.2f miles' % (kilometers, miles))
Comment on lines 31 to +32
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The format string is missing the second %, causing a TypeError at runtime — should we fix it to '%0.2f kilometers %0.2f miles' % (kilometers, miles)?

Finding types: Naming and Typos Logical Bugs | Severity: 🔴 High


Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

Prompt for AI Agents
In python/edits.py around lines 31-32, the print statement uses `'%0.2f kilometers 0.2f
miles' % (kilometers, miles)` — only one `%0.2f` placeholder for two values, raising a
TypeError at runtime. Update the format string to `'%0.2f kilometers %0.2f miles'` so
both `kilometers` and `miles` are formatted correctly, consistent with the pattern used
in python/additions.py and python/dir/deletions.py. Verify the output text is coherent
and no TypeError occurs on execution.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

apply commit


# Program to add two matrices using nested loop

X = [[12, 7, 3],
[4, 5, 6],
[7, 8, 9]]

Y = [[5, 8, 1],
[6, 7, 3],
Comment on lines 34 to 37
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The matrix-addition example is duplicated in python/additions.py and python/dir/deletions.py, should we extract a shared helper or centralized sample?

Finding type: Code Dedup and Conventions | Severity: 🟢 Low


Want Baz to fix this for you? Activate Fixer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

apply commit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

To apply a code change, reply to Baz with apply commit to push the fix to this PR's branch, or apply pr to open a follow-up PR with the fix.

[4, 5, 9]]
Expand Down