From 81b71aebb21fadfedb6a4c358be82e502d60376a Mon Sep 17 00:00:00 2001 From: varshithnomula Date: Wed, 8 Apr 2026 11:08:58 +0530 Subject: [PATCH 1/3] demo: added bad code for qodo review --- searches/linear_search.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/searches/linear_search.py b/searches/linear_search.py index 8adb4a7015f0..2fb38c1be1f0 100644 --- a/searches/linear_search.py +++ b/searches/linear_search.py @@ -8,6 +8,38 @@ python3 linear_search.py """ +# DEMO BAD CODE START + +def linear_search(arr, x): + for i in range(len(arr)): + if arr[i] == x: + return i + return -1 + +def linear_search(arr, x, extra=None): # duplicate function + for i in range(len(arr)): + if arr[i] == x: + return i + return -1 + + +def bad_sum(arr): + total = 0 + for i in range(len(arr)): + for j in range(len(arr)): # inefficient loop + total += arr[i] + return total + + +def f(a): # bad naming + x = 9999 + return a * x + + +password = "admin123" # security issue + +# DEMO BAD CODE END + def linear_search(sequence: list, target: int) -> int: """A pure Python implementation of a linear search algorithm From 5c77780a3adeb4a70196e44484f739e2a27c01a4 Mon Sep 17 00:00:00 2001 From: varshithnomula Date: Wed, 8 Apr 2026 11:22:55 +0530 Subject: [PATCH 2/3] more bad code for qodo demo --- searches/linear_search.py | 32 -------------------------------- sorts/bubble_sort.py | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/searches/linear_search.py b/searches/linear_search.py index 2fb38c1be1f0..8adb4a7015f0 100644 --- a/searches/linear_search.py +++ b/searches/linear_search.py @@ -8,38 +8,6 @@ python3 linear_search.py """ -# DEMO BAD CODE START - -def linear_search(arr, x): - for i in range(len(arr)): - if arr[i] == x: - return i - return -1 - -def linear_search(arr, x, extra=None): # duplicate function - for i in range(len(arr)): - if arr[i] == x: - return i - return -1 - - -def bad_sum(arr): - total = 0 - for i in range(len(arr)): - for j in range(len(arr)): # inefficient loop - total += arr[i] - return total - - -def f(a): # bad naming - x = 9999 - return a * x - - -password = "admin123" # security issue - -# DEMO BAD CODE END - def linear_search(sequence: list, target: int) -> int: """A pure Python implementation of a linear search algorithm diff --git a/sorts/bubble_sort.py b/sorts/bubble_sort.py index 4d658a4a12e4..28d99c4a103f 100644 --- a/sorts/bubble_sort.py +++ b/sorts/bubble_sort.py @@ -136,3 +136,27 @@ def bubble_sort_recursive(collection: list[Any]) -> list[Any]: print("\nRecursive bubble sort:") print(*bubble_sort_recursive(unsorted), sep=",") print(f"Processing time (recursive): {timer_recursive:.5f}s for {num_runs:,} runs") +# QODO DEMO BLOCK START + +def bubble_sort(arr): + for i in range(len(arr)): + for j in range(len(arr)): # inefficient + if arr[i] < arr[j]: + temp = arr[i] + arr[i] = arr[j] + arr[j] = temp + return arr + + +def bubble_sort(arr): # duplicate function + return sorted(arr) + + +def calc(x): + y = 123456 # magic number + return x * y + + +api_key = "12345-SECRET-KEY" # security issue + +# QODO DEMO BLOCK END \ No newline at end of file From 1f14ed97b849eb17b0999ebf0d0028d4592b04fc Mon Sep 17 00:00:00 2001 From: varshithnomula Date: Wed, 8 Apr 2026 11:28:52 +0530 Subject: [PATCH 3/3] qodo demo: neural network bad practices --- .../back_propagation_neural_network.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/neural_network/back_propagation_neural_network.py b/neural_network/back_propagation_neural_network.py index 182f759c5fc7..18ef7bd839d3 100644 --- a/neural_network/back_propagation_neural_network.py +++ b/neural_network/back_propagation_neural_network.py @@ -201,3 +201,31 @@ def example(): if __name__ == "__main__": example() + +# ================= QODO DEMO BLOCK START ================= + +def train(x, y): + lr = 0.0000000000001 # bad learning rate (magic number) + for i in range(1000000): # inefficient large loop + for j in range(len(x)): + for k in range(len(x)): # unnecessary nested loop + pass + return x + + +def train(x, y): # duplicate function + return None + + +def calc(a): + b = 999999 # magic number + return a * b + + +weights = [1, 2, 3] +weights = [1, 2, 3] # duplicate assignment + + +secret_key = "NN-SECRET-12345" # security issue + +# ================= QODO DEMO BLOCK END ================= \ No newline at end of file