Skip to content

Implement suite-test-name checker - #293

Open
mmorel-35 wants to merge 3 commits into
Antonboom:masterfrom
mmorel-35:suite-test-name
Open

Implement suite-test-name checker#293
mmorel-35 wants to merge 3 commits into
Antonboom:masterfrom
mmorel-35:suite-test-name

Conversation

@mmorel-35

@mmorel-35 mmorel-35 commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Adds the suite-test-name checker that enforces naming consistency between testify suite structs and their runner functions.

Rule

Runner function must be named Test<SuiteName>:

type BalanceSubscriptionSuite struct { suite.Suite }

// ❌ name doesn't match suite
func TestBalanceSubs_Run(t *testing.T) { suite.Run(t, new(BalanceSubscriptionSuite)) }

// ✅
func TestBalanceSubscriptionSuite(t *testing.T) { suite.Run(t, new(BalanceSubscriptionSuite)) }

Supports both new(SuiteName) and &SuiteName{} instantiation forms. Autofix renames the function identifier.

Enabled by default: false — pure style unification
Autofix: true

Changes

  • internal/checkers/suite_test_name.goAdvancedChecker using inspector.WithStack to find suite.Run calls, extract suite type name, and validate the enclosing function name
  • internal/checkers/checkers_registry.go — registered with enabledByDefault: false
  • internal/testgen/gen_suite_test_name.go + internal/testgen/main.go — test generator with errored/golden templates
  • analyzer/testdata/src/checkers-default/suite-test-name/ — generated test data
  • internal/checkers/checkers_registry_test.go, analyzer/checkers_factory_test.go — updated expected checker lists
  • README.md — checker documented in table and checkers section
  • CONTRIBUTING.md — removed from "Open for contribution"

Closes #48

@mmorel-35
mmorel-35 force-pushed the suite-test-name branch 4 times, most recently from dc26d5b to 16f2a82 Compare April 9, 2026 18:24
Copilot AI added a commit to mmorel-35/testifylint that referenced this pull request May 28, 2026
mmorel-35 pushed a commit to mmorel-35/testifylint that referenced this pull request May 28, 2026
@Antonboom Antonboom added the llm-based LLM shit label Jun 22, 2026
@Antonboom Antonboom self-assigned this Jun 22, 2026
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
… comments

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

llm-based LLM shit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suite-naming: enforce consistent suite naming

2 participants