Skip to content

Refine Codecov configuration to exclude cmd directory from coverage r… #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

hahwul
Copy link
Owner

@hahwul hahwul commented Mar 8, 2025

…eports

Copy link
Contributor

@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 @hahwul, 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 refines the Codecov configuration to exclude the cmd directory from coverage reports. This is achieved by modifying the codecov.yml file and the .github/workflows/codecov.yml workflow file. The changes ensure that the coverage reports focus on the pkg and lib directories, excluding the cmd directory which typically contains application entry points and might not require extensive test coverage.

Highlights

  • Exclusion of cmd directory: The cmd directory is now excluded from coverage reports in both codecov.yml and .github/workflows/codecov.yml.
  • Workflow Modification: The GitHub Actions workflow is updated to exclude the cmd directory when running coverage tests.

Changelog

  • .github/workflows/codecov.yml
    • Removed cmd/**/* from the paths filter for both push and pull_request triggers (lines 7 and 17).
    • Modified the go test command to exclude the cmd directory using go list and grep (line 39).
  • codecov.yml
    • The ignore section remains unchanged, continuing to exclude cmd/**/* (line 2).
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.


In realms of code, where coverage we seek,
The 'cmd' directory, now rendered meek.
Excluded from tests, its secrets concealed,
While 'pkg' and 'lib' their truths are revealed.

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
Contributor

@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

The pull request aims to refine the Codecov configuration by excluding the cmd directory from coverage reports. This is achieved by modifying the .github/workflows/codecov.yml and codecov.yml files. The changes seem reasonable and address the stated goal.

Summary of Findings

  • Redundant Exclusion: The cmd directory is excluded in both .github/workflows/codecov.yml and codecov.yml. While this ensures exclusion, it might be redundant. Consider if both are necessary or if one is sufficient.
  • Potential Impact: Excluding the cmd directory might affect the overall coverage percentage. Ensure that this exclusion doesn't hide critical uncovered code within the pkg or lib directories.

Merge Readiness

The changes seem straightforward and address the goal of excluding the cmd directory from coverage reports. However, it's important to consider the potential impact on overall coverage and whether the exclusion is implemented in the most efficient way. I am unable to approve this pull request, and recommend that other reviewers also look at this code before merging. The changes can be merged after addressing the concerns raised.

@@ -38,7 +36,7 @@ jobs:
with:
go-version: '1.23'
- name: Run coverage
run: go test -coverprofile=coverage.txt -covermode=atomic ./...
run: go test -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v /cmd/)
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This line modifies the go test command to exclude the cmd directory. Is this the intended behavior? It might be more robust to exclude the cmd directory in the codecov.yml file only, or to use a more specific path in the grep command to avoid unintended exclusions. Consider using grep -v "^./cmd/" to match the directory more precisely.

run: go test -coverprofile=coverage.txt -covermode=atomic $(go list ./... | grep -v "^./cmd/")

@hahwul hahwul merged commit 2fb7740 into main Mar 8, 2025
2 checks passed
@codecov-commenter
Copy link

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

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