Skip to content

test(T-03): validate SonarCloud integration#29

Open
raschmitt wants to merge 6 commits into
mainfrom
test/sonar-integration
Open

test(T-03): validate SonarCloud integration#29
raschmitt wants to merge 6 commits into
mainfrom
test/sonar-integration

Conversation

@raschmitt
Copy link
Copy Markdown
Owner

Summary

  • Adds intentional code issues to validate SonarCloud annotations on PRs
  • Expects 3 findings: hardcoded password (security), unused variable (code smell), and eval usage (critical)

Note: This PR should be closed without merging after validation.

raschmitt and others added 4 commits May 8, 2026 19:19
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@raschmitt raschmitt changed the title test: validate SonarCloud integration test(T-03): validate SonarCloud integration May 9, 2026
@raschmitt
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8170cb345b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/main.py
"""This will trigger SonarCloud warnings"""
password = "hardcoded123" # noqa: F841
unused_var = 42 # noqa: F841
eval("1+1") # Critical security issue
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove dynamic eval from shipped application code

test_sonar_comment is added to app/main.py, which is part of the runtime application package, and it executes eval(...). Even with a constant expression today, this introduces a dynamic-code-execution pattern into production code and is a security regression that Sonar validation does not require. Keep scanner-trigger fixtures out of runtime modules (for example, in dedicated test-only files) so this path cannot be invoked in app code.

Useful? React with 👍 / 👎.

Comment thread app/main.py

def test_sonar_comment():
"""This will trigger SonarCloud warnings"""
password = "hardcoded123" # noqa: F841
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Remove hardcoded credential literal from repository code

This commit adds a password-like hardcoded string in application source (password = "hardcoded123"). Even as a placeholder, committing credential-shaped literals in runtime code creates avoidable security noise (secret scanning alerts, audit false positives) and violates the repository’s no-hardcoded-secrets standard. If this is only for Sonar testing, it should be moved to an isolated non-production test fixture.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

💡 AI Code Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 290cb6e30e

ℹ️ About this review

This review was generated automatically by the AI Code Review workflow using OpenCode CLI with the Minimax M2.5 Free model.

Reviews are triggered on every pull request push.

Comment thread app/main.py

def test_sonar_comment():
"""This will trigger SonarCloud warnings"""
password = "hardcoded123" # noqa: F841
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Badge Hardcoded password

The string "hardcoded123" is a security issue. While this is intentional for testing, the PR notes it should be "closed without merging" — this code must not reach main.

Comment thread app/main.py
def test_sonar_comment():
"""This will trigger SonarCloud warnings"""
password = "hardcoded123" # noqa: F841
unused_var = 42 # noqa: F841
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Unused variable

unused_var is assigned but never used. The # noqa: F841 suppresses linting rather than fixing the issue.

from app.main import test_sonar_comment


def test_sonar_comment_runs():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Weak test

The test calls test_sonar_comment() without any assertions. It only verifies the function runs without crashing, not that it behaves correctly.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread app/main.py
return templates.TemplateResponse(request, "index.html")


def test_sonar_comment():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Missing type hints

The function test_sonar_comment() lacks type annotations. The project's code standards (AGENTS.md) require type hints on all function signatures.

Comment thread app/main.py
return templates.TemplateResponse(request, "index.html")


def test_sonar_comment():
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Badge Dead code in production

This function is not imported or called by any route in the application and serves no architectural purpose. It should be in a separate test/utility module, not in app/main.py.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)
B Maintainability 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

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.

1 participant