Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

冗長な { **h } の検出 #69

Open
znz opened this issue Nov 29, 2024 · 0 comments
Open

冗長な { **h } の検出 #69

znz opened this issue Nov 29, 2024 · 0 comments

Comments

@znz
Copy link

znz commented Nov 29, 2024

最近 { a: 1, **h } というような書き方をみかけて、その一種で { **h } というのをみかけました。(実際にはネストしたハッシュリテラルの一部でした。)

周辺をみると単純に冗長なだけで h.dup のように破壊的な変更を避けるために別ハッシュを生成しているという理由ではなさそうでした。

このような { **h } を検出して hh.dup に変更をうながす cop があると良さそうだと思いました。

前者は以前からある書き方だと h.merge(a: 1) に書き換えられますが、そこまでは必要ないかなと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant