Error with `rake stats` on modular monolith: TypeError: no implicit conversion of nil into String

This message was imported from the Ruby/Rails Modularity Slack server. Find more info in the import thread.

I just realized the rake stats doesn’t work for our modular monolith… I had thought I’d used it in the past, but now it’s crashing.

** Invoke stats (first_time)
** Invoke spec:statsetup (first_time)
** Execute spec:statsetup
** Invoke view_component:statsetup (first_time)
** Execute view_component:statsetup
** Execute stats
rake aborted!
TypeError: no implicit conversion of nil into String
<internal:dir>:98:in `open'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:46:in `foreach'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:46:in `calculate_directory_statistics'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:40:in `block in calculate_statistics'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:40:in `map'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:40:in `calculate_statistics'
/Users/gap/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/railties-7.0.6/lib/rails/code_statistics.rb:21:in `initialize'

Hm. My last usage of the tool seemed to show that whenever you move a file out of app the stats fail to show it… So I went with cloc instead

cloc packs
    1015 text files.
    1009 unique files.
      12 files ignored.

[github.com/AlDanial/cloc](http://github.com/AlDanial/cloc) v 1.96  T=0.32 s (3175.8 files/s, 153100.9 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Ruby                           766           5301           3054          30604
SCSS                            52            483             70           2617
YAML                            26            149              1           2467
JavaScript                      34            277            241           1584
Slim                            80             71              9           1281
SQL                             14              0              0            167
Markdown                         9             59              0            100
CSV                             27              5              0             87
ERB                              1              0              0             15
-------------------------------------------------------------------------------
SUM:                          1009           6345           3375          38922
-------------------------------------------------------------------------------

That was easy.