Skip to content

Commit c88d995

Browse files
martinvonzkejadlen
authored andcommitted
docs: add a style guide
jj-vcs#5685
1 parent 11befaa commit c88d995

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

docs/contributing.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,17 @@ directory](https://github.com/jj-vcs/jj/tree/main/cli/src/commands). Working
115115
on them requires setting up a Rust development environment, as described
116116
below, and may occasionally require adjusting a test.
117117

118-
119118
## Learning Rust
120119

121120
In addition to the [Rust Book](https://doc.rust-lang.org/book/) and the other
122121
excellent resources at <https://www.rust-lang.org/learn>, we recommend the
123122
["Comprehensive Rust" mini-course](https://google.github.io/comprehensive-rust/)
124123
for an overview, especially if you are familiar with C++.
125124

125+
## Style guide
126+
127+
See [here](style_guide.md).
128+
126129
## Setting up a development environment
127130

128131
To develop `jj`, the mandatory steps are simply

docs/style_guide.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Style guide
2+
3+
## Panics
4+
5+
Panics are not allowed, especially in code that may run on a server. Calling
6+
`.unwrap()` is okay if it's guaranteed to be safe by previous checks or
7+
documented invariants. For example, if a function is documented as requiring
8+
a non-empty slice as input, it's fine to call `slice[0]` and panic.
9+
10+
## Markdown
11+
12+
Try to wrap at 80 columns. We don't have a formatter yet.

0 commit comments

Comments
 (0)