Skip to content

Commit

Permalink
Merge pull request #698 from LandonTClipp/badcode
Browse files Browse the repository at this point in the history
Minor refactor and dead code removal
  • Loading branch information
LandonTClipp authored Aug 29, 2023
2 parents 74e483d + 6111fde commit 8965d12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
25 changes: 10 additions & 15 deletions cmd/mockery.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,18 @@ func (r *RootApp) Run() error {
Str(logging.LogKeyQualifiedName, iface.QualifiedName).
Logger()

// output stream provider determines where the mock file
// will actually live
if osp == nil {
osp = &pkg.FileOutputStreamProvider{
Config: r.Config,
BaseDir: r.Config.Output,
InPackage: r.Config.InPackage,
InPackageSuffix: r.Config.InPackageSuffix,
TestOnly: r.Config.TestOnly,
Case: r.Config.Case,
KeepTree: r.Config.KeepTree,
KeepTreeOriginalDirectory: r.Config.Dir,
FileName: r.Config.FileName,
}
}
ifaceCtx := ifaceLog.WithContext(ctx)

shouldGenerate, err := r.Config.ShouldGenerateInterface(ifaceCtx, iface.QualifiedName, iface.Name)
if err != nil {
return err
}
if !shouldGenerate {
ifaceLog.Debug().Msg("config doesn't specify to generate this interface, skipping.")
continue
}
ifaceLog.Debug().Msg("config specifies to generate this interface")

outputter := pkg.NewOutputter(&r.Config, boilerplate, true)
if err := outputter.Generate(ifaceCtx, iface); err != nil {
return err
Expand Down
9 changes: 0 additions & 9 deletions pkg/outputter.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,6 @@ func (m *Outputter) Generate(ctx context.Context, iface *Interface) error {
Logger()
ctx = log.WithContext(ctx)

shouldGenerate, err := m.config.ShouldGenerateInterface(ctx, iface.QualifiedName, iface.Name)
if err != nil {
return err
}
if !shouldGenerate {
log.Debug().Msg("config doesn't specify to generate this interface, skipping.")
return nil
}
log.Debug().Msg("config specifies to generate this interface")
log.Info().Msg("generating mocks for interface")

log.Debug().Msg("getting config for interface")
Expand Down

0 comments on commit 8965d12

Please sign in to comment.