Add test-no-assertions and os-chdir-in-test rules
what
- Introduced a new lint rule,
test-no-assertions, to detect and flag test functions that contain only logging statements (t.Log,t.Logf) and no actual assertions (t.Error,t.Fatal,assert.*,require.*). - This rule also identifies and flags tests that unconditionally skip (e.g., direct
t.Skip()calls orif true { t.Skip() }). - Added the
os-chdir-in-testrule to the lintroller documentation, which was previously undocumented.
why
- Preventing documentation-only tests: Tests that only log provide no value in terms of coverage or regression detection and can clutter the test suite. This rule ensures that tests actually verify behavior.
- Preventing unconditionally skipped tests: Tests that always skip provide a false sense of security, consume CI resources without value, and can indicate forgotten work. This rule enforces that skips are conditional and meaningful.
-
Improving documentation: The
os-chdir-in-testrule was added to the README to ensure all lintroller rules are properly documented.
references
- closes # (No specific issue number provided in the context)
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 66.75%. Comparing base (897d199) to head (cb03db0).
:warning: Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #1657 +/- ##
=======================================
Coverage 66.74% 66.75%
=======================================
Files 364 364
Lines 42499 42499
=======================================
+ Hits 28365 28369 +4
+ Misses 12045 12041 -4
Partials 2089 2089
| Flag | Coverage Ξ | |
|---|---|---|
| unittests | 66.75% <ΓΈ> (+<0.01%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more. see 2 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
π₯ This pull request now has conflicts. Could you fix it @osterman? π
π₯ This pull request now has conflicts. Could you fix it @osterman? π
Dependency Review
β No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned Files
None
π₯ This pull request now has conflicts. Could you fix it @osterman? π