faraazahmad / shellrb

A unix-like shell built in Ruby
MIT License
35 stars 24 forks source link

Adding coding style #34

Closed Doshirae closed 6 years ago

Doshirae commented 6 years ago

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 ^^

pknight24 commented 6 years ago

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:

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.

Doshirae commented 6 years ago

Is a tab value of two spaces equivalent to two spaces or it has to be two actual spaces? (yeah that's a newbie question but I prefer to clarify things)

On 16 November 2017 16:17:24 CET, Parker Knight notifications@github.com wrote:

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.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faraazahmad/shellrb/issues/34#issuecomment-344954068

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

pknight24 commented 6 years ago

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

faraazahmad commented 6 years ago

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 commented 6 years ago

Yeah i was aware of the Ruby style of 2 spaces, i was just wondering if a tab of value 2 spaces is considered 2 spaces or 1 tab

Otherwise, that's not a problem, i can easily set my editor to replace a tab by 2 actual spaces, don't worry

On 16 November 2017 17:21:03 CET, Syed Faraaz Ahmad notifications@github.com wrote:

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.

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/faraazahmad/shellrb/issues/34#issuecomment-344975577

-- Sent from my Android device with K-9 Mail. Please excuse my brevity.

faraazahmad commented 6 years ago

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