dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.3k stars 1.59k forks source link

Add a lint for classes named "Mock" something that don't have a noSuchMethod #57811

Open natebosch opened 6 years ago

natebosch commented 6 years ago

It's very unlikely that a class without a noSuchMethod is a Mock. It is much more likely to be a stub or a fake. If we can trust that these terms are used precisely it's easier to read test code, but it's a very prevalent mistake to name a stub or fake as MockSomething. We could look for a good reference explaining the difference in these terms and point the lint at it since it's a good way to spread knowledge.

matanlurey commented 6 years ago

I support this. To me this is mostly a style question, but in large enough code bases consistency is important to me.