rebellion icon indicating copy to clipboard operation
rebellion copied to clipboard

Style rulebook internal documentation

Open jackfirth opened this issue 5 years ago • 2 comments

Now that Rebellion has received a few pull requests from others, I should write down the style rules I follow inside Rebellion's codebase. A separate Scribble document (as in, not the "rebellion" document defined in the info.rkt file's scribblings field) seems appropriate. This would be distinct from #196 in two ways:

  • It's meant for people contributing to Rebellion, not people using Rebellion
  • It's a collection of rules, not recommendations. Style rules are for enforcing consistency when there are multiple ways to write something and the choice doesn't matter.

To start, here's some things I'll probably add to the rulebook:

  • Always use #lang to specify the module language, not top-level (module ...) forms
  • provide goes at the top of each module, before any require forms (unless they import forms necessary for expanding provide, like contract-out)
  • Imports in a require form are in sorted order
  • Lines must be at most 80 characters
  • DrRacket's auto-indenter should leave files unchanged
  • Opening parens in #lang racket/base should never be immediately followed by whitespace ( like this)
  • Closing parens in #lang racket/base should never be immediately preceded by whitespace (like this )

Hopefully I can automate finding and fixing code that breaks these rules. They're not worth devoting manual attention to in reviews.

jackfirth avatar Oct 17 '19 01:10 jackfirth

Style rules inspired by #292:

  • No trailing whitespace
  • Newline at the end of each file

jackfirth avatar Oct 18 '19 08:10 jackfirth

Scribble style rules related to DrRacket's auto-indentation:

  • Use parens instead of brackets with examples, e.g. @(examples (foo) (bar) (baz)) instead of @examples[(foo) (bar) (baz)].
  • Use double brackets with deftogether, e.g. @deftogether[[@defproc[...] @defform[...] @defthing[...]]].

jackfirth avatar Jan 25 '20 20:01 jackfirth