uber / mockolo

Efficient Mock Generator for Swift
Apache License 2.0
804 stars 85 forks source link

Skip creation of empty files if there are no mocks to generate #250

Open azatZul opened 6 months ago

azatZul commented 6 months ago

What did you do?

Run mockolo -s <SOURCE> -d <DESTINATION> on the source folder which doesn't have protocols with mockable annotation. It generated a file without any mocks.

What did you expect to happen?

I'd expect the empty file won't be created. Or at least having a flag which allows to skip creation of those empty files. I recognise that the tools also will need to remove the destination file in that case which adds some complications but still, arguable it's worth it.

What is the use-case

If in a modularised project the script is executed once per module, modules which not yet added mock annotation will end up having empty files which is not ideal.

Mockolo Environment

Mockolo Version: 2.0.1 Dependency Manager: Homebrew Xcode Version: 15.0

sidepelican commented 2 months ago

An empty file implies an empty output. Is there a problem, or is it just a matter of feelings?

sidepelican commented 2 months ago

I want to ensure that first-time users are not confused if no file is generated. If it's a matter of feelings, I'm curious to know if there are others who agree.