Antonboom / testifylint

The Golang linter that checks usage of github.com/stretchr/testify.
https://github.com/stretchr/testify
MIT License
98 stars 9 forks source link

suite-subtest-run: report on usage `suite.T().Run` instead of `suite.Run` #35

Closed ArtAndreev closed 3 months ago

ArtAndreev commented 10 months ago

According to https://github.com/stretchr/testify/blob/db8608ed63f5bd9abdd03f669f5bb80569c114b6/suite/suite.go#L96 suite.Run should be used for running subtests instead of directly running subtests with testing.T.

I ran into some problems with invalid running subtests and want this linter to report such invalid usage.

Antonboom commented 10 months ago

Hi, @ArtAndreev!

Thank you for request. Do you mean CONTRIBUTING.md#suite-run?

Could you provide the concrete example this concrete problems? 🙏

P.S. Why s.T() just not return trimmed interface? 🤔 Maybe we already have known issue in testify project?

Antonboom commented 10 months ago
  1. https://github.com/stretchr/testify/issues/1139
  2. https://github.com/stretchr/testify/issues/889
  3. https://github.com/stretchr/testify/pull/510
  4. https://gophers.slack.com/archives/C92321HDJ/p1628032842014900?thread_ts=1627781651.013900&cid=C92321HDJ
ArtAndreev commented 10 months ago

Hi!

The problem occurs very rarely, it's hard to understand why it happens. It raises data race between tests, but the only t.Parallel call is in function that runs suite.

I have just read CONTRIBUTING.md, looks like the unimplemented checks from it should be mentioned in README.md, so I wouldn't have raised this issue. Anyway, sorry for noise 🙂.

ArtAndreev commented 10 months ago

Ah, already mentioned:

Also look at open for contribution checkers

Sorry for noise.

Antonboom commented 4 months ago

Also: