Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have some warnings/errors for bad library usage #413

Open
dmaclach opened this issue May 6, 2020 · 2 comments
Open

Have some warnings/errors for bad library usage #413

dmaclach opened this issue May 6, 2020 · 2 comments

Comments

@dmaclach
Copy link
Contributor

dmaclach commented May 6, 2020

This isn't really an issue as opposed to a meta feature request.

We use OCMock in a large codebase with hundreds of projects. OCMock as a library is very easy to use "incorrectly", especially after code has been refactored a few times. There are a few places in ocmock where I would like to be able to have a "warning" that could be also an "error". Examples:

  • Expect after a stub that is being masked by the stub
  • Stub after a stub that is being masked by the first stub
  • Stub/Expect after reject
  • Mock that has expects on it that are never verified
  • Mocks that are verified that never have expects on them
  • ignoringNonObjectArgs on methods with no non object parameters
  • Multiple calls being recorded by a single recorder
  • and.* type blocks on rejects
  • stubs that aren't called

What I would want to be able to do is to have these as logging warnings until I could get them fixed on a project by project basis, and then turn them into throwing errors to prevent backsliding in the future. I was thinking of having it controllable by an environment variable as well as a global BOOL flag.

Thoughts?

@dmaclach
Copy link
Contributor Author

dmaclach commented May 7, 2020

See #414 as an example

@matrush
Copy link
Contributor

matrush commented May 27, 2020

Yeah. I have had to manually fix hundreds of files (if not thousands) manually in my previous version bump to 3.5. (I did it 😂)
With a large codebase it's really annoying :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants