https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112017-11-10T16:20:08ZRuby Issue Tracking SystemRuby master - Feature #14098: The HowToContribute guide can be improvedhttps://bugs.ruby-lang.org/issues/14098?journal_id=677732017-11-10T16:20:08Zshevegen (Robert A. Heiler)shevegen@gmail.com
<ul></ul><ul>
<li>
<p>I agree in regards to tests; perhaps the article could mention if patch submissions should also include tests. I see the ruby core team often also adding test-code when they change/add behaviour/functionality. An example, or a separate entry at the wiki for such an example, might be useful to have there.</p>
</li>
<li>
<p>I think the NEWS entry at <a href="https://github.com/ruby/ruby/blob/trunk/NEWS" class="external">https://github.com/ruby/ruby/blob/trunk/NEWS</a> is largely hand-written. Not sure if automatic entries are used there.</p>
</li>
<li>
<p>I do not think that there is any implicit code style for ruby. There is more than one way to write ruby :) - or actually, the one to enforce ruby convention is the ruby parser. One could find a matz-style (where the best style would be how matz writes ruby) but I think this does not exist either. Rubocop enforces one particular default style but there are many who don't use that style, so I think it would be difficult to assume that ruby code (or C-style code) has to follow a convention. It may be that the C code in MRI may have some style. Perhaps the C code how nobu writes it, is the best variant. :D</p>
</li>
</ul>
<p>Array code in C could be found at: <a href="https://github.com/ruby/ruby/blob/trunk/array.c" class="external">https://github.com/ruby/ruby/blob/trunk/array.c</a></p>
<p>This one has a certain naming style/convention.</p>
<p>For example, the functions start with "ary_",<br>
and the static VALUE entry comes above the name.</p> Ruby master - Feature #14098: The HowToContribute guide can be improvedhttps://bugs.ruby-lang.org/issues/14098?journal_id=677802017-11-11T21:28:30Zana06 (Ana Maria Martinez Gomez)
<ul></ul><p><a class="user active user-mention" href="https://bugs.ruby-lang.org/users/3414">@shevegen (Robert A. Heiler)</a></p>
<blockquote>
<p>An example, or a separate entry at the wiki for such an example, might be useful to have there.</p>
</blockquote>
<p>Yes, it would be great.</p>
<blockquote>
<p>I think the NEWS entry at <a href="https://github.com/ruby/ruby/blob/trunk/NEWS" class="external">https://github.com/ruby/ruby/blob/trunk/NEWS</a> is largely hand-written</p>
</blockquote>
<p>Should I add new changes to this file when creating a PR with a new feature for example?</p>
<blockquote>
<p>I do not think that there is any implicit code style for ruby. There is more than one way to write ruby :) - or actually, the one to enforce ruby convention is the ruby parser. One could find a matz-style (where the best style would be how matz writes ruby) but I think this does not exist either. Rubocop enforces one particular default style but there are many who don't use that style, so I think it would be difficult to assume that ruby code (or C-style code) has to follow a convention. It may be that the C code in MRI may have some style. Perhaps the C code how nobu writes it, is the best variant. :D</p>
</blockquote>
<p>With code style I was more focused on the C code which makes Ruby, and not in how to write Ruby. But actually both are interesting, as Ruby code is used in the documentation. I think having a defined style makes both understanding the code and write new code much easier.</p>
<blockquote>
<p>Array code in C could be found at: <a href="https://github.com/ruby/ruby/blob/trunk/array.c" class="external">https://github.com/ruby/ruby/blob/trunk/array.c</a></p>
<p>This one has a certain naming style/convention.</p>
</blockquote>
<p>But I also find some inconsistencies in this file. For example:</p>
<ul>
<li>Spaces between operators:</li>
</ul>
<pre><code class="C syntaxhl" data-language="C"><span class="n">ARY_SET_LEN</span><span class="p">(</span><span class="n">ary</span><span class="p">,</span> <span class="n">idx</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
<span class="n">EMMOVE</span><span class="p">(</span><span class="n">ptr</span><span class="p">,</span> <span class="n">ptr</span><span class="o">+</span><span class="n">n</span><span class="p">,</span> <span class="n">VALUE</span><span class="p">,</span> <span class="n">RARRAY_LEN</span><span class="p">(</span><span class="n">ary</span><span class="p">)</span><span class="o">-</span><span class="n">n</span><span class="p">);</span>
</code></pre> Ruby master - Feature #14098: The HowToContribute guide can be improvedhttps://bugs.ruby-lang.org/issues/14098?journal_id=941462021-10-15T21:51:30Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>I updated <a href="https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute" class="external">https://bugs.ruby-lang.org/projects/ruby/wiki/HowToContribute</a> to discuss testing and where to document changes. The guide already contained a statement to follow the style of the existing code, and I don't think we need to be more specific than that.</p>