Add show_patch_table configuration option for PR comments#528
Closed
blimpich wants to merge 1 commit intocodecov:mainfrom
Closed
Add show_patch_table configuration option for PR comments#528blimpich wants to merge 1 commit intocodecov:mainfrom
blimpich wants to merge 1 commit intocodecov:mainfrom
Conversation
This adds a new boolean configuration option `show_patch_table` under the `comment` section of codecov.yml that controls whether the patch coverage table is automatically added to PR comments when using the `files` or `tree` layout components. By default, `show_patch_table: true` maintains existing behavior where the `newfiles` section (patch coverage table) is automatically appended when `files` or `tree` is present in the layout. Setting `show_patch_table: false` allows users to display only the files table with coverage delta information without the patch coverage table. Example usage: ```yaml comment: layout: "files" show_patch_table: false # Show only Coverage Δ table, not Patch % table ``` This resolves the issue where users who want concise PR comments showing only overall coverage changes per file had no way to hide the automatically injected patch coverage table. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
@blimpich, thanks for the PR here. Unfortunately we aren't supporting new configurations to our yaml currently and wont plan to in the near future. I would recommend opening an issue next time to get buy in from the team first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new boolean configuration option
show_patch_tableunder thecommentsection ofcodecov.ymlthat controls whether the patch coverage table is automatically added to PR comments when using thefilesortreelayout components.Problem
Currently, when users specify
layout: "files"orlayout: "tree"in their codecov.yml, the system automatically injects thenewfilessection, which displays a "Patch %" table showing patch coverage information. This behavior is hardcoded at lines 57-59 inapps/worker/services/notification/notifiers/mixins/message/sections.py:There is no way for users to disable this automatic injection, even if they only want to see the overall coverage delta per file (the "Coverage Δ" table) without the patch-specific information.
Solution
This PR introduces a new configuration option
show_patch_table(defaults totrueto maintain backward compatibility) that controls whether the automatic injection occurs.Changes Made
Schema Update (
libs/shared/shared/validation/user_schema.py):show_patch_tableas a boolean field with default valueTrueLogic Update (
apps/worker/services/notification/notifiers/mixins/message/sections.py):show_patch_tablesetting before addingnewfilesExample Usage
Users can now configure their PR comments to show only the files coverage delta table:
Use Case
This feature is valuable for teams that:
Backward Compatibility
By defaulting
show_patch_tabletotrue, all existing configurations will continue to work exactly as before. Only users who explicitly setshow_patch_table: falsewill see the new behavior.Testing
The changes are minimal and focused:
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com