Skip to content
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

Integration of Codecov to Compare Unit Test Code Coverage Metrics in Go #3976

Closed
S-ayanide opened this issue May 17, 2023 · 5 comments
Closed
Assignees
Labels
go Pull requests that update Go code good first issue LFX-MENTORSHIP Linux Foundation Mentor ship Issue

Comments

@S-ayanide
Copy link
Member

Description:

I would like to propose the integration of Codecov into our Go project to compare unit test code coverage metrics generated by the regular Go tool. This integration will provide us with valuable insights into the code coverage of our tests, enabling us to identify areas that require more thorough testing.

Current Situation:

Currently, we are using the regular Go tool to generate code coverage metrics for our unit tests. While this provides us with basic coverage information, it lacks the ability to compare coverage across different branches, pull requests, and commits. It also lacks visual representation and easy-to-understand reports, making it difficult to track the progress of our code coverage over time.

Proposed Solution:

Integrating Codecov into our Go project will address the limitations mentioned above and provide us with comprehensive code coverage reports. Codecov offers a range of features, including visual coverage reports, branch comparison, and pull request integration. By integrating Codecov, we will have access to the following benefits:

  • Detailed Reports: Codecov generates detailed reports that provide insights into which lines of code are covered by tests and which ones are not. These reports can help us identify areas of our codebase that require additional testing.
  • Visual Representation: Codecov presents code coverage metrics in an easily understandable and visually appealing format. This makes it simpler for team members to track the progress of code coverage and identify areas that need attention.
  • Branch Comparison: Codecov allows us to compare code coverage across different branches, enabling us to assess the impact of changes on our test coverage. This feature is particularly useful when working on feature branches or when evaluating the impact of a specific change.
  • Pull Request Integration: By integrating Codecov with our pull request workflow, we can automatically analyze the code coverage impact of proposed changes. This ensures that new code contributions maintain or improve our overall coverage.

Steps to Implement:

To integrate Codecov into our Go project, we will need to perform the following steps:

  • Sign up for a Codecov account at https://codecov.io/ if we don't have one already.
  • Add the necessary configuration to our project's CI/CD pipeline to collect and upload coverage data to Codecov. This may involve updating our existing test command or adding a separate coverage command.
  • Configure our CI/CD pipeline to send coverage data to Codecov after running the tests. This can be achieved by leveraging Codecov's command-line interface or using dedicated integrations available for common CI/CD systems like Jenkins, Travis CI, or GitHub Actions.
  • Set up branch comparison and pull request integration within Codecov to enable comparison and analysis of coverage metrics across different branches and pull requests.

Review the generated reports and use the insights to improve our test coverage and identify areas for further testing.

Integrating Codecov will significantly enhance our ability to track and improve the code coverage of our Go project. By visualizing and comparing coverage metrics, we can make data-driven decisions to ensure that our codebase is well-tested and maintainable.

@S-ayanide S-ayanide added the LFX-MENTORSHIP Linux Foundation Mentor ship Issue label May 17, 2023
@S-ayanide S-ayanide added good first issue go Pull requests that update Go code labels May 17, 2023
@namkyu1999
Copy link
Member

Here's a Demo

https://app.codecov.io/gh/namkyu1999/litmus

@namkyu1999
Copy link
Member

Are there any updates about the security issue @S-ayanide ?

@mridul549
Copy link

Can I work on this issue?

@jignyasamishra
Copy link

@S-ayanide @namkyu1999 Hello! I have raised a PR. Please review it.Thank you!!

@S-ayanide
Copy link
Member Author

After thorough consideration and in light of the recent security breach issue reported by Codecov (referenced here: Codecov Security Update), we have decided not to move forward with Codecov as our unit test coverage metrics collection tool.

The security of our code and data is of utmost importance, and the mentioned security incident raises concerns about the overall integrity and safety of using Codecov at this time.

In exploring alternatives, we are open to considering tools that prioritize security and align with our use case. Two options we are interested in exploring are SonarQube and GuardRails. It's worth noting that we have previously tried Codeacy and DeepScan, but found them unsuitable for our use case. Codeacy did not meet our requirements, and DeepScan, while effective for frontend issues, does not align with our current needs.

Let's initiate the exploration of SonarQube and GuardRails, and please feel free to share any insights or concerns regarding these alternatives. Additionally, if anyone has other suggestions, please bring them to the discussion.

@S-ayanide S-ayanide changed the title Integration of Codecov to Compare Unit Test Code Coverage Metrics in Go Integration of SonarQube to Compare Unit Test Code Coverage Metrics in Go Mar 14, 2024
@S-ayanide S-ayanide changed the title Integration of SonarQube to Compare Unit Test Code Coverage Metrics in Go Integration of Codecov to Compare Unit Test Code Coverage Metrics in Go Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code good first issue LFX-MENTORSHIP Linux Foundation Mentor ship Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants