rebellion
rebellion copied to clipboard
Style rulebook internal documentation
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 anyrequire
forms (unless they import forms necessary for expandingprovide
, likecontract-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.
Style rules inspired by #292:
- No trailing whitespace
- Newline at the end of each file
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[...]]]
.