Skip to content

Conversation

Copy link

Copilot AI commented Jan 13, 2026

Removed tech debt across Python, C#, and JavaScript codebases.

Security Fixes

  • SQL Injection Vulnerabilities (python/sql.py)
    • Replaced string concatenation with parameterized queries in search_user() and add_user()
    • Fixed missing parentheses in add_user() connection instantiation
# Before
query = "SELECT * FROM users WHERE username = '" + username + "'"
cursor.execute(query)

# After  
query = "SELECT * FROM users WHERE username = %s"
cursor.execute(query, (username,))

Code Simplification

  • TaskItem.CalculateTaskScore (DotnetApp/Models/TaskItem.cs)
    • Extracted CalculateHighPriorityScore() and CalculateMediumPriorityScore() methods
    • Replaced nested if-else chains with early returns and switch expressions
    • Reduced cognitive complexity: 110 lines → 66 lines

Dead Code Removal

  • Deleted 3 empty files: python/point.py, terraform/iac.tf, python/tests/test_calculator.py
  • Removed unused imports from DotnetApp/Program.cs (System.IO, Microsoft.Extensions.FileProviders)

JavaScript Quality

  • list-utils.js: Fixed linting violations (unused vars, var→const/let, shadowing, ==→===)
  • math-utils.js: Removed module-level side effects (console.log on import)

Net: -53 lines, 2 security fixes, 0 new test failures

Original prompt

Can you clean up this codebase for me?

Custom agent used: Janitor
Perform janitorial tasks on any codebase including cleanup, simplification, and tech debt remediation.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 13, 2026 18:31
…code

Co-authored-by: mpchenette <98562887+mpchenette@users.noreply.github.com>
Co-authored-by: mpchenette <98562887+mpchenette@users.noreply.github.com>
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
E Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE


def add_user(username, password):
conn = mysql.connector.connect
conn = mysql.connector.connect(user='root', password='password', host='localhost', database='users')

Check failure

Code scanning / SonarCloud

Credentials should not be hard-coded High

Revoke and change this password, as it is compromised. See more on SonarQube Cloud
Copilot AI changed the title [WIP] Refactor and clean up codebase for better readability Clean up codebase: remove dead code, fix SQL injection, simplify complex methods Jan 13, 2026
Copilot AI requested a review from mpchenette January 13, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants