Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Trailing comma in AST

オープン
#4,091 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
ruby
領域
compilers

調査の方向性

まず、Prism における ArrayNode と HashNode の処理、および rubyfmt が Prism の AST をどのように利用しているかを確認します。既存のフォーマット動作を変更せずに、これらのノードについて末尾のカンマの有無を表現できるか調査します。Prism がこの情報を追跡すべきかどうかについて、具体的な推奨事項を文書化できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement

For background, Stripe uses rubyfmt to format Ruby. One thing rubyfmt doesn't have today is trailing commas: all trailing commas are stripped by formatting, which is the preference of the maintainers of that project.

For a while I've wished for something like "rubyfmt + trailing commas." Before it even makes sense to have the conversation about whether to make that change, I was thinking through what it would even look like in practice. One thing which would make things easier to adopt would be if rubyfmt could run in a mode that preserves trailing commas, rather than universally adding or removing them (you could migrate slices of a codebase at a time, instead of having to land a PR touching hundreds of thousands of files all at once).

rubyfmt now uses prism for parsing Ruby files, and prism omits information about whether various constructs had trailing commas.

I was curious to get a temperature check on whether this is something that prism would ever want to see tracked. For example, in ArrayNode or in HashNode, to have some way to know that the user had written a trailing comma.

This is a very "what if" sort of line of thought, so please don't feel rushed to answer, and also I completely understand if the answer is definitively "that's not something prism is open to incorporating."

主要言語
C
スター
1k
フォーク
194
平均マージ
2日 6時間
マージ済み PR(30日)
15

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ruby/prism のほかの issue

ruby/prism の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。