CONTRIBUTING.md 1.95 KB
Newer Older
Michal  Stopyra's avatar
Michal Stopyra committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Crystal Linux General Contributing Guidelines

### Pre-Commit Checks

- Make sure to format AND lint your code before every commit push
- Always make sure you're on a custom branch, never commit directly to main (Most repositories have protections against doing this). 
  `main` is a protected branch and should only be MRed against from other branches once the code is proven to be stable

### Formatting

#### General
- UNIX line endings (LF instead of CRLF)
- Please keep variable names descriptive (e.g., `archive` instead of `ar`)

#### Rust
- 4 spaces per indent
- Format code with `cargo fmt` before every commit

#### Python
- 4 spaces per indent
Michal  Stopyra's avatar
Michal Stopyra committed
21
- Format code with `black` before every commit
Michal  Stopyra's avatar
Michal Stopyra committed
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
- No sloppy code! I better at LEAST see an `if __name__ == "__main__":` if your code is actually going to run as a script.

#### Nix
- 2 spaces per indent
- Check derivations/flakes with `statix`, `nix-linter` and format with `nixfmt`

### Git

- Please don't leave `Merge ...` commits. They clutter up the git log.
- All development is to take place on `main` from now on. Releases will be handled as versioned Git tags on `main`
- Please follow the [GNOME Git Commit Message Guidelines](https://wiki.gnome.org/Git/CommitMessages)

### Good Practices

- Make sure to annotate what each commit actually changes... `git diff` is your friend.
- Try to use handle all errors if possible.
- Never leave an unhandled exception in production code. If you have found a behaviour that runs an uncaught exception, catch the exception.
- Never use `println!()` or the langauge's default print function/macro in production code. Using prettified string functions (e.g. info() in Amethyst v3.0.0) is
  preferred
- Compartmentalise as much as you can, avoid writing the exact same line of code 50 times if you can turn it into a
  function

### Examples of these guidelines in practice

- [Amethyst](https://git.getcryst.al/crystal/softare/amethyst)
- [Jade](https://git.getcryst.al/crystal/software/jade)