Skip to content

test: improve test coverage from 85.7% to 88.2%#2

Merged
mpyw merged 1 commit intomainfrom
improve-test-coverage
Dec 19, 2025
Merged

test: improve test coverage from 85.7% to 88.2%#2
mpyw merged 1 commit intomainfrom
improve-test-coverage

Conversation

@mpyw
Copy link
Copy Markdown
Owner

@mpyw mpyw commented Dec 19, 2025

Summary

  • Add test cases for higher-order function patterns that return variables (covers ReturnedValueUsesContext and returnedValueSatisfiesDerive)
  • Add unit tests for ignore directive package (covers AllCheckerNames, parseIgnoreComment, etc.)
  • Improve overall test coverage from 85.7% to 88.2%

Key Coverage Improvements

Function Before After
returnedValueSatisfiesDerive 15.8% 68.4%
ReturnedValueUsesContext 13.3% 73.3%
AllCheckerNames 0% 100%
usesContextDeep 85.7% 95.2%
checkCallResultFuncUsesContext 68.8% 87.5%

Changes

Test fixtures added

  • goroutine/evil.go: Higher-order variable return patterns
  • errgroup/evil.go: Higher-order variable return patterns
  • waitgroup/evil.go: Higher-order variable return patterns
  • goroutinederive/goroutinederive.go: Higher-order and variable function patterns

Unit tests added

  • internal/directives/ignore/directive_test.go: Tests for ignore directive parsing

Test plan

  • ./test_all.sh passes
  • golangci-lint run ./... passes
  • Coverage improved from 85.7% to 88.2%

🤖 Generated with Claude Code

Add test cases for higher-order function patterns that return variables:
- goroutine: goodHigherOrderReturnsVariableWithCtx, badHigherOrderReturnsVariableWithoutCtx
- errgroup: goodHigherOrderReturnsVariableWithCtx, badHigherOrderReturnsVariableWithoutCtx
- waitgroup: goodHigherOrderReturnsVariableWithCtx, badHigherOrderReturnsVariableWithoutCtx
- goroutinederive: Higher-order and variable function patterns

Add unit tests for ignore directive package:
- TestAllCheckerNames
- TestParseIgnoreComment
- TestBuild
- TestShouldIgnore
- TestGetUnusedIgnores

Key coverage improvements:
- returnedValueSatisfiesDerive: 15.8% -> 68.4%
- ReturnedValueUsesContext: 13.3% -> 73.3%
- AllCheckerNames: 0% -> 100%
- usesContextDeep: 85.7% -> 95.2%
- checkCallResultFuncUsesContext: 68.8% -> 87.5%

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Dec 19, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

@mpyw mpyw merged commit 68ede3c into main Dec 19, 2025
14 checks passed
@mpyw mpyw deleted the improve-test-coverage branch December 19, 2025 04:42
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.

1 participant