Skip to content

Have some warnings/errors for bad library usage #413

@dmaclach

Description

@dmaclach

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?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions