Project

General

Profile

Feature #14098

The HowToContribute guide can be improved

Added by ana06 (Ana Maria Martinez Gomez) about 2 years ago. Updated about 2 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:83730]

Description

I miss some important information in the HowToContribute guide:

  • how is the code tested? Should I add new test of my code? where, how and how to execute it?
  • How are important changes tracked? How is the changelog created? should I write my changes somewhere when modifying the code?
  • Is the code following any style rule?

Is this somewhere documented?

Thanks!

History

Updated by shevegen (Robert A. Heiler) about 2 years ago

  • 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.

  • I think the NEWS entry at https://github.com/ruby/ruby/blob/trunk/NEWS is largely hand-written. Not sure if automatic entries are used there.

  • 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

Array code in C could be found at: https://github.com/ruby/ruby/blob/trunk/array.c

This one has a certain naming style/convention.

For example, the functions start with "ary_",
and the static VALUE entry comes above the name.

Updated by ana06 (Ana Maria Martinez Gomez) about 2 years ago

shevegen (Robert A. Heiler)

An example, or a separate entry at the wiki for such an example, might be useful to have there.

Yes, it would be great.

I think the NEWS entry at https://github.com/ruby/ruby/blob/trunk/NEWS is largely hand-written

Should I add new changes to this file when creating a PR with a new feature for example?

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

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.

Array code in C could be found at: https://github.com/ruby/ruby/blob/trunk/array.c

This one has a certain naming style/convention.

But I also find some inconsistencies in this file. For example:

  • Spaces between operators:
ARY_SET_LEN(ary, idx + 1);
EMMOVE(ptr, ptr+n, VALUE, RARRAY_LEN(ary)-n);

Also available in: Atom PDF