Skip to content
This repository was archived by the owner on Apr 23, 2025. It is now read-only.

Conversation

@ipv1337
Copy link

@ipv1337 ipv1337 commented Apr 14, 2025

This PR removes debugging flags from SonarCloud scans and aligns the local scanner script arguments with CI workflow configuration.\n\nChanges:\n- Removed -Dsonar.verbose=true flag from GitHub workflow configuration\n- Updated local run_sonar_scan.sh script to use consistent arguments with CI

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @ipv1337, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on improving the SonarCloud integration and code coverage reporting. It removes a debugging flag from the SonarCloud configuration, aligns the local scanner script arguments with the CI workflow, and makes adjustments to coverage reporting and handling of test failures. The PR also excludes the ollama.py file from coverage reports due to its integration with external dependencies.

Highlights

  • SonarCloud Configuration: The -Dsonar.verbose=true flag has been removed from the GitHub workflow configuration to reduce verbosity during SonarCloud scans.
  • Local Scan Alignment: The run_sonar_scan.sh script has been updated to use consistent arguments with the CI workflow, ensuring consistent scanning behavior between local and CI environments. Specifically, it now includes properties for sonar.sources, sonar.tests, sonar.sourceEncoding, sonar.scm.provider, and sonar.coverage.jacoco.xmlReportPaths.
  • Coverage Reporting: The .coveragerc file has been modified to include more specific paths for coverage and to exclude ollama.py from coverage reports. ollama.py is excluded because it is difficult to test without mocking the entire Ollama API.
  • CI Test Handling: The run_coverage_ci.sh script has been updated to exit on test failures in CI, ensuring code quality. The script now uses the CI_EXIT_ON_TEST_FAILURE value set at the beginning of the script to determine whether to exit with an error code on test failures, and the --cov-append flag is added to pytest.
  • SonarCloud New Code: The sonar-project.properties file now includes sonar.newCode.referenceBranch=origin/main to force SonarCloud to see all files as new code for proper coverage metrics. A comment indicates this is temporary and should be removed after an initial coverage baseline is established.

Changelog

Click here to see the changelog
  • .coveragerc
    • Expanded the include section to cover more Python files.
    • Added */src/cli_code/models/ollama.py to the omit section, excluding it from coverage reports.
  • pr_description.md
    • The entire file has been removed.
  • scripts/run_coverage_ci.sh
    • Changed CI_EXIT_ON_TEST_FAILURE to 1 to exit on test failures in CI.
    • Added --cov-append to the pytest command for generating the final coverage report.
    • Removed the reassignment of CI_EXIT_ON_TEST_FAILURE at the end of the script.
  • scripts/run_sonar_scan.sh
    • Added properties to the sonar-scanner command to align with CI, including sonar.sources, sonar.tests, sonar.sourceEncoding, sonar.scm.provider, and sonar.coverage.jacoco.xmlReportPaths.
  • sonar-project.properties
    • Added a comment explaining the exclusion of ollama.py from coverage.
    • Added sonar.newCode.referenceBranch=origin/main to force SonarCloud to treat all code as new for initial coverage metrics.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


The scanner hums, a watchful eye,
On code that strives to reach the sky.
With flags aligned and tests that gleam,
A cleaner build, a coder's dream.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR aims to remove debugging flags from SonarCloud scans and align the local scanner script arguments with the CI workflow configuration. The changes look good overall, contributing to a cleaner and more consistent build process.

Summary of Findings

  • Coverage Exclusions: The PR excludes ollama.py from coverage due to integration code with external dependencies. While understandable, consider if mocking or integration tests can be added to improve coverage in the future.
  • CI Exit on Test Failure: The PR changes the CI to exit on test failures. This is a good practice to ensure code quality and prevent merging code with failing tests.
  • SonarCloud Configuration: The PR updates the local run_sonar_scan.sh script to use consistent arguments with CI, ensuring a more reliable and comparable analysis between local and CI environments.
  • SonarCloud New Code Metrics: The PR temporarily forces SonarCloud to see all files as new code. Remember to remove this after the initial coverage baseline is established to ensure future PRs are evaluated correctly.

Merge Readiness

The changes in this PR are beneficial for maintaining code quality and aligning local scans with CI. However, the temporary SonarCloud configuration should be removed after the initial coverage baseline is established. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

Comment on lines 23 to 26
# Note: We're using this temporarily to establish accurate baseline coverage
# TODO: Remove this line after initial coverage baseline is established to ensure
# future PRs are evaluated correctly for new code coverage
sonar.newCode.referenceBranch=origin/main

Choose a reason for hiding this comment

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

high

This section introduces a temporary configuration to force SonarCloud to treat all files as new code. It's crucial to remove this line after the initial coverage baseline is established to ensure accurate future PR evaluations. Leaving a TODO is good, but consider adding a specific date or issue link for tracking.


# Set environment variables for CI
export CI_EXIT_ON_TEST_FAILURE=0 # Don't exit on test failures in CI
export CI_EXIT_ON_TEST_FAILURE=1 # Exit on test failures to ensure code quality

Choose a reason for hiding this comment

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

medium

Setting CI_EXIT_ON_TEST_FAILURE to 1 is a good practice to ensure that the CI pipeline fails if any tests fail. This helps prevent merging code with failing tests.

@github-actions
Copy link

Code Coverage Report

📊 Current Coverage: 38.35%

Detailed coverage analysis is available in SonarCloud

Coverage Change Details

This shows code coverage for changes in this PR. To improve coverage, consider adding tests for new or modified code.

@github-actions
Copy link

Code Coverage Report

📊 Current Coverage: 38.35%

Detailed coverage analysis is available in SonarCloud

Coverage Change Details

This shows code coverage for changes in this PR. To improve coverage, consider adding tests for new or modified code.

@sonarqubecloud
Copy link

@ipv1337 ipv1337 merged commit b6f92f1 into main Apr 14, 2025
5 checks passed
@ipv1337 ipv1337 deleted the feature/remove-sonarcloud-debugging branch April 14, 2025 08:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants