Skip to content

Simplify redundant-test-docstring rule to flag all single-line test docstrings#19150

Merged
harupy merged 6 commits intomasterfrom
copilot/update-redundant-test-docstrings
Dec 2, 2025
Merged

Simplify redundant-test-docstring rule to flag all single-line test docstrings#19150
harupy merged 6 commits intomasterfrom
copilot/update-redundant-test-docstrings

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Related Issues/PRs

#xxx

What changes are proposed in this pull request?

The redundant-test-docstring clint rule previously used string similarity heuristics to determine if a single-line test docstring was redundant. This PR simplifies the rule to flag all single-line test docstrings, as they rarely add meaningful context beyond what the test name already conveys.

Rule changes:

  • Removed similarity check logic (_is_redundant_docstring method and related imports)
  • Now flags any single-line docstring in test functions, test classes, and test modules
  • Updated error messages for clarity

Codebase cleanup:

  • Created automation script to remove flagged docstrings
  • Removed 546 single-line test docstrings across 104 files
  • Verified zero violations remain with uv run clint .

Before:

def test_feature_validation():
    """Test feature validation."""  # Only flagged if similar to function name
    assert validate_feature()

After:

def test_feature_validation():
    # All single-line docstrings now flagged, multi-line still allowed
    assert validate_feature()

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Updated test expectations in test_redundant_test_docstring.py to reflect new behavior. All 11 tests pass.

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)
Original prompt

Update dev/clint/src/clint/rules/redundant_test_docstring.py (and dev/clint/tests/rules/test_redundant_test_docstring.py too) to flag any single line test docstrings as redundant. The exisitng similarity check can be removed. Once updated, run uv run clint . to ensure no violations exist. To fix the violations, write an automation script instead of manually editing each test file.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
@harupy harupy added the only-latest If applied, only test the latest version of each group in cross-version tests. label Dec 2, 2025
Copilot AI and others added 2 commits December 2, 2025 04:15
Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Co-authored-by: harupy <17039389+harupy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update redundant test docstring check to flag single line docs Simplify redundant-test-docstring rule to flag all single-line test docstrings Dec 2, 2025
Copilot AI requested a review from harupy December 2, 2025 04:20
@harupy harupy marked this pull request as ready for review December 2, 2025 04:20
@github-actions github-actions bot added area/build Build and test infrastructure for MLflow rn/none List under Small Changes in Changelogs. labels Dec 2, 2025
@harupy harupy added the team-review Trigger a team review request label Dec 2, 2025
@harupy harupy added this pull request to the merge queue Dec 2, 2025
Merged via the queue into master with commit bd9e5e4 Dec 2, 2025
46 checks passed
@harupy harupy deleted the copilot/update-redundant-test-docstrings branch December 2, 2025 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Build and test infrastructure for MLflow only-latest If applied, only test the latest version of each group in cross-version tests. rn/none List under Small Changes in Changelogs. team-review Trigger a team review request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants