codecov
umbrella
BlogDocsChangelog

feat: implement partials_as_hits feature for LCOV parser

#383Merged
Comparing
vlad-ko:feature/implement-partials-as-hits-lcov
(
6cba48a
) with
main
(
2a2ca6e
)
CodSpeed Performance Gauge
0%
Untouched
9

Benchmarks

Passed

test_parse_full
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
488.3 ms487.1 ms
test_report_serialize
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
5.7 ms5.7 ms
test_report_filtering
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
2.3 s2.3 s
test_report_merge
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
2.8 s2.8 s
test_report_diff_calculation[Report]
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
1.9 ms1.9 ms
test_report_diff_calculation[FilteredReport]
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
2.9 ms2.9 ms
test_process_totals
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
591.6 ms592.3 ms
test_parse_shallow
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
0%
9.5 ms9.5 ms
test_report_carryforward
libs/shared/tests/benchmarks/test_report.py
CodSpeed Performance Gauge
-1%
5.4 ms5.4 ms

Commits

Click on a commit to change the comparison range
Base
main
2a2ca6e
0%
feat: implement partials_as_hits feature for LCOV parser This commit adds support for the partials_as_hits configuration option to the LCOV parser, bringing it in line with other coverage parsers (JaCoCo, Cobertura, Go). ## Changes Made ### Core Implementation - **lcov.py**: Added partials_as_hits configuration reading and conversion logic - **_process_file()**: Updated to accept partials_as_hits parameter - **Branch processing**: Convert partial coverage (e.g., '1/2') to hits (1) when enabled ### Configuration Schema - **user_schema.py**: Added LCOV parser configuration validation - Supports: parsers.lcov.partials_as_hits (boolean, default: false) ### Test Coverage - **test_lcov.py**: Added comprehensive test cases: - test_lcov_partials_as_hits_enabled(): Tests conversion of partials to hits - test_lcov_partials_as_hits_disabled(): Tests default behavior preservation - test_lcov_partials_as_hits_mixed_coverage(): Tests mixed scenarios - **test_validation.py**: Added schema validation tests ### Documentation - **LCOV_PARTIALS_AS_HITS.md**: Comprehensive feature documentation including: - Implementation details and logic - Usage examples and migration guide - Consistency with other parsers - Test coverage overview ## Behavior ### With partials_as_hits: true - '1/2' partial coverage → 1 (hit) - '2/3' partial coverage → 1 (hit) - '2/2' full hit → '2/2' (unchanged) - '0/2' miss → '0/2' (unchanged) ### With partials_as_hits: false (default) - All coverage types remain unchanged (backward compatible) ## Configuration Example ## Implementation Details - Follows established patterns from JaCoCo, Cobertura, and Go parsers - Minimal performance impact (single boolean check per branch line) - Comprehensive test coverage with realistic LCOV data - Backward compatible (defaults to false) Closes: #[issue-number] (if applicable) Co-authored-by: TDD Implementation Process
8be99d2
4 months ago
by vlad-ko
+0.03%
fix: preserve branch coverage type in LCOV partials_as_hits Critical bug fix addressing incorrect branch counting when partials_as_hits is enabled. ## Problem When partials_as_hits was enabled, partial branches were converted from: - coverage: '1/2' -> 1 ✅ (correct) - coverage_type: CoverageType.branch -> CoverageType.line ❌ (incorrect) This caused get_line_totals() to exclude converted partials from branch counts since it only counts lines with type='b' (CoverageType.branch maps to 'b'). ## Solution - Keep coverage_type as CoverageType.branch for converted partials - This maintains proper branch counting: line.type = 'b' - Aligns behavior with JaCoCo parser (preserves branch type) - Ensures accurate branch coverage metrics ## Changes - lcov.py: Remove incorrect coverage_type change to CoverageType.line - test_lcov.py: Update test expectations to expect 'b' type for converted partials - LCOV_PARTIALS_AS_HITS.md: Correct documentation ## Verification - Converted partials now maintain branch type for proper counting - Tests updated to reflect correct behavior - Branch coverage metrics will be accurate Fixes: Branch count inconsistency when partials_as_hits enabled Severity: Critical - affects coverage metrics accuracy
abf1443
4 months ago
by vlad-ko
-0.05%
style: apply ruff formatting to test_lcov.py Auto-formatting applied by pre-commit hooks to match project style guidelines. The tuple formatting was changed to multi-line format for better readability.
6e92f65
4 months ago
by vlad-ko
-0.07%
style: apply ruff formatting to LCOV tests Auto-formatting applied by pre-commit hooks: - Remove trailing whitespace after triple quotes - Multi-line format for long tuple in test_lcov_partials_as_hits_mixed_coverage This prevents CI formatting loops by applying the formatting locally.
7d323cd
4 months ago
by vlad-ko
+0.04%
fix: add boolean type casting for LCOV partials_as_hits config - Fix issue where string 'false' would be truthy in YAML config - Add robust boolean casting to handle 'false', 'true', '0', '1', etc. - Add test to verify string 'false' correctly behaves as boolean False - Refactor tests to eliminate duplication using class properties - Move repeated LCOV test data to PARTIAL_BRANCH_LCOV_DATA class property - Add reusable partial_test_path_fixer static method This prevents configuration bugs where users specify boolean values as strings in YAML, ensuring partials_as_hits works correctly regardless of how the boolean is specified in the configuration.
c0ad006
4 months ago
by vlad-ko
-0.09%
Add .cursor to .gitignore
9a5ecc2
4 months ago
by vlad-ko
+0.26%
Empty commit to trigger CI - investigating flaky test
f92c830
4 months ago
by vlad-ko
-0.14%
Delete LCOV_PARTIALS_AS_HITS.md
f9d404a
17 days ago
by drazisil-codecov
+0.06%
Delete .gitignore
3a2a6a6
17 days ago
by drazisil-codecov
-0.07%
restore .gitignore
6cba48a
17 days ago
by drazisil-codecov
© 2025 CodSpeed Technology
Home Terms Privacy Docs