Prism parser no longer accepts legacy ghost method directives without a leading colon
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ruby
- Área
- documentation
Línea de trabajo
Comienza en el manejo de comentarios del parser de Prism y sigue cómo llegan los comentarios al parser común de directivas. Añade pruebas que cubran las directivas de métodos legacy y canónicos, métodos singleton y atributos; después, verifica que ambas formas produzcan los miembros esperados y conserven las directivas canónicas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
The previous Ruby parser accepted ghost/meta directives both with and without
an initial colon:
# method: foo
# :method: foo
RDoc 8.0.0 only recognizes the canonical second form.
Although the form without the initial colon is not the currently documented
syntax, the previous parser explicitly supported it. Existing documentation
relies on this behavior.
Minimal reproduction
class Example
##
# method: legacy_method
# A legacy ghost method directive.
##
# :method: canonical_method
# A canonical ghost method directive.
end
With RDoc 6.17.0:
Example.method_list.map(&:name)
# => ["legacy_method", "canonical_method"]
With RDoc 8.0.0:
Example.method_list.map(&:name)
# => ["canonical_method"]
The previous parser deliberately made the initial colon optional:
/^# +:?method:/
It did the same for singleton-method and attribute directives.
Real-world example
net-imap documents members created dynamically by Struct using this
syntax:
##
# method: media_type
# :call-seq: media_type -> string
Source:
https://github.com/ruby/net-imap/blob/v0.6.4.1/lib/net/imap/response_data.rb#L903
RDoc 8 does not create the ghost method, so references such as:
rdoc-ref:BodyTypeBasic#media_type
cannot be resolved.
Expected behavior
For backward compatibility, the Prism parser should recognize both:
# method: foo
# :method: foo
The same compatibility should apply to:
method
singleton-method
attr
attr_reader
attr_writer
attr_accessor
Suggested fix
Before passing Ruby comments to the common directive parser, normalize legacy
meta directives to their canonical form.
For example:
LEGACY_META_DIRECTIVE =
/^([ \t]*\#[ \t]+)(singleton-method|method|attr(?:_reader|_writer|_accessor)?):/i
A match can be rewritten from:
# method: foo
to:
# :method: foo
Canonical directives must remain unchanged.
Tests should cover both forms for methods, singleton methods, and attributes.
Environment
Ruby 4.0.5 +PRISM
RDoc 8.0.0
Prism 1.9.0
- Lenguaje dominante
- Ruby
- Estrellas
- 929
- Forks
- 469
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 19
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ruby/rdoc
-
RDoc 8.0.0 gem omits `doc/rdoc/example.rb`, which is referenced by the packaged markup documentationPosiblemente ocupada @OskarEichler la tomó hace 37 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
ruby/rdoc#1759 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
ruby/rdoc#1823 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Wrong heading levels in generated HTML?Posiblemente ocupada @st0012 la tomó hace 2 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
ruby/rdoc#1822 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Issues similares
-
Add Catalan (ca) translationAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
eurosky-social/eu-haul#32 ·
-
README configuration examples use the wrong module name and describe removed Bootstrap assetsAbiertogood first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
benbalter/add-to-org#17 ·
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
benbalter/change_agent#11 ·
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
benbalter/count-org-loc#20 ·
-
good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
benbalter/sitemap-parser#33 ·