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

Default value expressions are returned incorrectly

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
ruby
領域
documentation

調査の方向性

lib/puppet-strings/yard/parsers/puppet/statement.rb の 89-90 行目を読み、次に issue で参照されている Puppet の SourcePosAdapter と locator メソッドを比較します。class test($param = 1 + 1) のデフォルト式がどのように抽出されるかを追跡します。完了条件は、Puppet の互換性を損なうことなく、返される値に完全な 1 + 1 式が含まれることです。

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

説明

bugfix

Describe the Bug

Complex parameter default expressions (specifically those involving an AST branch node) are returned incorrectly.

For example:

class test($param = 1 + 1) { ... }

The default value for $param is returned as +.

Expected Behavior

The default value should be returned as 1 + 1.

Additional Context

This seems to happen because ParameterizedStatement parser uses a SourcePosAdapter from Puppet to extract the text for the AST object. However, the extract_text method it calls only extracts the text for the AST branch itself, not for the entire tree rooted in that branch. The SourcePosAdapter calls @object.locator.extract_text, but there is an extract_tree_text method available on the locator which seems to do the right thing.

https://github.com/puppetlabs/puppet-strings/blob/main/lib/puppet-strings/yard/parsers/puppet/statement.rb#L89-L90
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/pops/adapters.rb#L63
https://github.com/puppetlabs/puppet/blob/master/lib/puppet/pops/parser/locator.rb#L55

I would file a PR but I'm not deep enough into puppet-strings to understand its relationship to Puppet and the compatibility issues involved with the SourcePosAdapter to know the appropriate place to make this change.

主要言語
Ruby
スター
90
フォーク
91
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

puppetlabs/puppet-strings のほかの issue

puppetlabs/puppet-strings の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

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

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