Shopify/packwerk

[Bug Report] `packwerk init` failing due to TypeError

Closed this issue · 0 comments

Description
When running bundle exec packwerk init on a fresh install, a Sorbet TypeError was thrown when generating the configuration file. This is due to a missing load_paths value, for which Sorbet expects to receive an Array.

To Reproduce

  1. Run bundle exec packwerk init in a project that doesn't yet have a packwerk config file

Expected Behaviour
All init generators should run without failure.

Version Information

  • Packwerk: v1.0.2
  • Ruby: v2.7.1

Additional Context
This problem seems to have been introduced in #68, specifically at https://github.com/Shopify/packwerk/pull/68/files#diff-e43184d1a960a3c3821da21b3eb72c83379c2dcc996f6bcfac9aadd6898cd374L45.

Error details:

Parameter 'load_paths': Expected type T::Array[String], got type NilClass (TypeError)
Caller: /Users/mikelkew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sorbet-runtime-0.5.6084/lib/types/private/methods/call_validation.rb:78
Definition: /Users/mikelkew/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/packwerk-1.0.2/lib/packwerk/generators/configuration_file.rb:21