From 185978d5e94c134d486aaa3322b1080fc275ae52 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:24:25 +0000 Subject: [PATCH 1/3] Initial plan From aeac20c71c9158dde54b8ad8b3a6a5d839731981 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:31:31 +0000 Subject: [PATCH 2/3] Clean up codebase: remove empty files, fix vulnerabilities, simplify code Co-authored-by: mpchenette <98562887+mpchenette@users.noreply.github.com> --- DotnetApp/Models/TaskItem.cs | 110 +++++++++++------------------------ python/point.py | 0 python/sql.py | 10 ++-- terraform/iac.tf | 0 web-utils/src/list-utils.js | 30 ++++------ web-utils/src/math-utils.js | 3 - 6 files changed, 51 insertions(+), 102 deletions(-) delete mode 100644 python/point.py delete mode 100644 terraform/iac.tf diff --git a/DotnetApp/Models/TaskItem.cs b/DotnetApp/Models/TaskItem.cs index ea15aaf..5008bca 100644 --- a/DotnetApp/Models/TaskItem.cs +++ b/DotnetApp/Models/TaskItem.cs @@ -20,108 +20,66 @@ public class TaskItem public int CalculateTaskScore() { - int score = 0; - - score += CalculatePriorityScore(); - score += CalculateStatusScore(score); + int priorityScore = CalculatePriorityScore(); + int statusScore = CalculateStatusScore(priorityScore); - return Math.Max(0, score); + return Math.Max(0, priorityScore + statusScore); } private int CalculatePriorityScore() { - int score = 0; - - if (Priority <= 0) - { - score += 1; - } - else if (Priority == 1) - { - score += 10; - if (Status == "pending") - { - score += 3; - } - } - else if (Priority == 2) - { - score += 5; - if (Status == "in-progress" && !IsCompleted) - { - score += 2; - if ((DateTime.UtcNow - CreatedAt).TotalDays > 7) - { - score += 3; - } - } - } - else - { - score += 1; - } + if (Priority <= 0) return 1; + if (Priority == 1) return CalculateHighPriorityScore(); + if (Priority == 2) return CalculateMediumPriorityScore(); + return 1; + } + private int CalculateHighPriorityScore() + { + int score = 10; + if (Status == "pending") score += 3; return score; } - private int CalculateStatusScore(int currentScore) + private int CalculateMediumPriorityScore() { - int score = 0; - - switch (Status.ToLower()) + int score = 5; + if (Status == "in-progress" && !IsCompleted) { - case "pending": - score += CalculatePendingScore(currentScore); - break; - case "in-progress": - score += CalculateInProgressScore(); - break; - default: - if (!IsCompleted && Priority < 3) - { - score += 3; - } - break; + score += 2; + if ((DateTime.UtcNow - CreatedAt).TotalDays > 7) score += 3; } - return score; } - private int CalculatePendingScore(int currentScore) + private int CalculateStatusScore(int priorityScore) { - int score = 0; - - if ((DateTime.UtcNow - CreatedAt).TotalDays > 14) + return Status.ToLower() switch { - score += currentScore * 2; - if (Priority < 3) - { - score += 5; - } - } + "pending" => CalculatePendingScore(priorityScore), + "in-progress" => CalculateInProgressScore(), + _ => (!IsCompleted && Priority < 3) ? 3 : 0 + }; + } + private int CalculatePendingScore(int priorityScore) + { + if ((DateTime.UtcNow - CreatedAt).TotalDays <= 14) return 0; + + int score = priorityScore * 2; + if (Priority < 3) score += 5; return score; } private int CalculateInProgressScore() { - int score = 0; + if (IsCompleted) return -5; - if (IsCompleted) - { - score -= 5; - } - else + int score = 0; + foreach (var word in Title.Split(' ')) { - foreach (var word in Title.Split(' ')) - { - if (word.Length > 10) - { - score += 1; - } - } + if (word.Length > 10) score += 1; } - return score; } } diff --git a/python/point.py b/python/point.py deleted file mode 100644 index e69de29..0000000 diff --git a/python/sql.py b/python/sql.py index bc2121e..ff6190b 100644 --- a/python/sql.py +++ b/python/sql.py @@ -3,22 +3,22 @@ def search_user(username): conn = mysql.connector.connect(user='root', password='password', host='localhost', database='users') cursor = conn.cursor() - query = "SELECT * FROM users WHERE username = '" + username + "'" + query = "SELECT * FROM users WHERE username = %s" # Execute the query and process the results - cursor.execute(query) + cursor.execute(query, (username,)) result = cursor.fetchall() cursor.close() conn.close() return result def add_user(username, password): - conn = mysql.connector.connect + conn = mysql.connector.connect(user='root', password='password', host='localhost', database='users') cursor = conn.cursor() - query = "INSERT INTO users (username, password) VALUES ('" + username + "', '" + password + "')" + query = "INSERT INTO users (username, password) VALUES (%s, %s)" # Execute the query - cursor.execute(query) + cursor.execute(query, (username, password)) conn.commit() cursor.close() conn.close() diff --git a/terraform/iac.tf b/terraform/iac.tf deleted file mode 100644 index e69de29..0000000 diff --git a/web-utils/src/list-utils.js b/web-utils/src/list-utils.js index be8f2b9..39555a6 100644 --- a/web-utils/src/list-utils.js +++ b/web-utils/src/list-utils.js @@ -1,29 +1,23 @@ -// List utilities for client-side rendering (with intentional issues for lint demo) -var foo = 1 // missing semicolon, uses var -let bar = 2 -let unused = 3 +// List utilities for client-side rendering +const foo = 1; +const bar = 2; export function areEqual(a, b) { - if (a == b) { // eqeqeq violation - console.log("Equal!\n"); // double quotes + if (a === b) { + console.log('Equal!\n'); } } export function renderList(items) { - let bar = 'shadowed'; - console.log(bar) + const localBar = 'local'; + console.log(localBar); - // undefined variable usage - console.log(result) + const arr = [1, 2, 3]; + arr.push(4); - // prefer-const violation - let arr = [1,2,3] - arr.push(4) - - // mixed spaces and tabs - for (var i = 0; i < items.length; i++) { - console.log(items[i]) + for (let i = 0; i < items.length; i++) { + console.log(items[i]); } - areEqual(foo, bar) + areEqual(foo, bar); } diff --git a/web-utils/src/math-utils.js b/web-utils/src/math-utils.js index a8dcd7e..1c4951c 100644 --- a/web-utils/src/math-utils.js +++ b/web-utils/src/math-utils.js @@ -10,6 +10,3 @@ export function sum(nums) { if (!Array.isArray(nums)) return 0; return nums.reduce((acc, n) => acc + n, 0); } - -greet('World'); -console.log('Sum:', sum([1, 2, 3])); From 185cbb6875457169eded3272c9ce33082e1f7452 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 18:33:26 +0000 Subject: [PATCH 3/3] Remove unused imports and empty test file Co-authored-by: mpchenette <98562887+mpchenette@users.noreply.github.com> --- DotnetApp/Program.cs | 4 +--- python/tests/test_calculator.py | 0 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 python/tests/test_calculator.py diff --git a/DotnetApp/Program.cs b/DotnetApp/Program.cs index 586449a..055fa8f 100644 --- a/DotnetApp/Program.cs +++ b/DotnetApp/Program.cs @@ -1,6 +1,4 @@ -using System.IO; -using System.Linq; -using Microsoft.Extensions.FileProviders; +using System.Linq; using DotnetApp.Services; using DotnetApp.Models; diff --git a/python/tests/test_calculator.py b/python/tests/test_calculator.py deleted file mode 100644 index e69de29..0000000