Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Option to omit private methods from gem RBIs, with a per-gem opt-in

Abierto
#2,740 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 4 días

@efegokdemir ya está trabajando en esto.

Desde el 14/10/2026.

  • #2743 de @efegokdemir — abierto

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
ruby
Área
tooling

Línea de trabajo

Start with the Methods listener that skips private methods during tapioca gem and with merge_with_exported_rbi, which the issue says must run after filtering. Read how typed_overrides is parsed from the config to model the new gem options. Done means private_methods: false omits private methods except for gems in private_methods_for, and gems that export their own RBIs keep their private markers after the merge.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

tapioca gem emits every private method it finds. Application code only reaches a gem's private methods through implicit-receiver calls from subclasses, including modules, or DSLs like Rake::DSL, so for most gems these definitions add size and diff churn without affecting type checking.

In a large Rails app (501 gems in the bundle, RBIs generated for 395), 332 of the generated RBIs contain private methods. After stripping private methods from all of them, srb tc passes once private methods are restored for just 9 gems:

  • rake: Rake::DSL#task, #namespace, #desc, called at the top level of every .rake file
  • activerecord: default_scope, transaction_include_any_action?
  • tapioca: Tapioca::Dsl::Compiler#compile_method_parameters_to_rbi, #compile_method_return_type_to_rbi, .all_classes, used by custom DSL compilers
  • rbi: RBI::Visitor#visit_*, which RBI::RBSPrinter overrides with override sigs in the gem's own RBI
  • karafka: Karafka::Instrumentation::Vendors::Datadog::MetricsListener#consumer_tags and #namespaced_metric, overridden by a subclass in another gem
  • super_diff, shoulda-matchers, rubocop, and one internal gem: helpers called from subclasses

Potential reduction

Keeping private methods for those 9 gems and omitting them for the other 386:

Before After Change
Method definitions 198,737 177,402 -10.7%
RBI size, excluding comments 14.3 MB 13.3 MB -7.2%
RBI size, total 38.8 MB 37.0 MB -4.8%
RBI lines, total 1,082,949 1,020,568 -5.8%

Gem upgrades that only touch private methods would also stop producing RBI diffs.

Proposal

A gem option that turns private methods off, plus a list of gems that keep them, similar in shape to typed_overrides:

gem:
  private_methods: false
  private_methods_for:
    - rake
    - activerecord

Defaulting private_methods to true keeps today's output.

Implementation note

We prototyped this with a patch loaded from sorbet/tapioca/require.rb. The filtering has to run after merge_with_exported_rbi. When the Methods listener skips private methods instead, gems that export their own RBIs (pdf-reader, rbi, spoom, prism) declare many of those methods without a private marker, and the merge brings them back as public methods.

Happy to open a PR if this sounds reasonable.

Lenguaje dominante
Ruby
Estrellas
874
Forks
167
Merge medio
5 d 12 h
PR fusionados (30 d)
11

Preparar el entorno

  • Sin Dockerfile ni archivo de Docker Compose
  • Tiene una plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Shopify/tapioca

Todos los issues de Shopify/tapioca

Issues similares

Más issues de Ruby

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.