faraazahmad/shellrb

Adding coding style

Closed this issue · 6 comments

I just got into the project, since I find it very nice and welcoming for begginers in open-source

Could someone who have contributed for a while make a coding style guide ?
As an example, the paradigms of programmation to use (e.g. I really like functionnal programming, but I don't know if everyone is into it, so maybe I won't code functionnaly)
Or maybe code how you want, as long as you comment/document well your code ?

Thank you ^^

Thanks for showing interest in shellrb!

It wouldn't be a terrible idea to add to style guide to our CONTRIBUTING.md file, but for now:

  • Terminal commands are written as classes, with their own methods and fields.
  • Be sure to document everything very well. Basically, someone who has never looked at the code before should be able to understand what's going on.
  • We use two spaces for indentation, single quotes, and no parentheses when possible. If you look at some of the code base, you'll be able to tell what's going on pretty quickly. I wrote Echo.rb and Cat.rb, if you want to look at those in particular.

If there is anything that I left out, I'm sure that @faraazahmad can clear it up for you. Be sure to look at the contributing file for any other instructions.

I generally use two spaces, but I am not 100% positive on that one.

First of all, I'm really glad you found shellrb welcoming for beginners, if you think any more improvements could be made in that area, feel free to discuss them in #27 .

All of what @pknight24 said is true. We use single quotes when string interpolation is not required. We use 2 spaces as indentation so that the code looks same everywhere. But manually entering spaces is cumbersome, so you can convert tabs to spaces in your editor.

Btw, an indentation of width 2 spaces is actually part of Ruby's default style guide.

@Doshirae @pknight24 coding style has been added in CONTRIBUTING.md