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

IO::Buffer improvements and documentation. #9329

Merged
merged 22 commits into from Dec 24, 2023

Conversation

ioquatix
Copy link
Member

@ioquatix ioquatix commented Dec 23, 2023

Tidy up the documentation of the C implementation.

@ioquatix ioquatix force-pushed the io-buffer-documentation branch 3 times, most recently from 0a50939 to 752adf4 Compare December 23, 2023 10:22
@nobu
Copy link
Member

nobu commented Dec 23, 2023

Doesn't look documentation only?

@ioquatix ioquatix changed the title Documentation improvements. Documentation and code improvements. Dec 23, 2023
@ioquatix
Copy link
Member Author

You are correct, I reorganised and made some minor improvements of the code too.

io_buffer_extract_flags(VALUE argument)
{
if (rb_int_negative_p(argument)) {
rb_raise(rb_eArgError, "Flags can't be negative!");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually don’t end error messages with exclamation (or period).

Copy link
Member Author

@ioquatix ioquatix Dec 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we documented this anywhere? I suggest we add documentation around conventions that we expect to be followed in CRuby (e.g. naming conventions, exception messages, code organisation, etc). We can change these messages, however I prefer to have clear exclamations when reporting errors. Currently, there are a number of places in the code that follow this convention.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can reference something like this: https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions

Use grammatically correct error messages
Write clear sentences and include ending punctuation. Each sentence in the string assigned to the Exception.Message property should end in a period. For example, "The log table has overflowed." would be an appropriate message string.

@ioquatix ioquatix force-pushed the io-buffer-documentation branch 2 times, most recently from 93b13e9 to f2c5497 Compare December 24, 2023 03:08
@ioquatix ioquatix changed the title Documentation and code improvements. IO::Buffer improvements and documentation. Dec 24, 2023
@ioquatix ioquatix force-pushed the io-buffer-documentation branch 4 times, most recently from 075c798 to 7c1b46f Compare December 24, 2023 12:21
@ioquatix ioquatix merged commit 37753f1 into ruby:master Dec 24, 2023
97 checks passed
@ioquatix ioquatix deleted the io-buffer-documentation branch December 24, 2023 13:03
@nurse nurse mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants