|
| 1 | +# Code Style |
| 2 | + |
| 3 | +This project is subject attempts to automate code style to a great degree, using |
| 4 | +these tools: |
| 5 | + |
| 6 | +* `cargo clippy` |
| 7 | +* `cargo fmt` |
| 8 | + |
| 9 | +We do not allow for warnings: all warnings are errors. Lading is written in a |
| 10 | +"naive" style where abstraction is not preferred if a duplicated pattern will |
| 11 | +satisfy. Our reasoning for this is it makes ramp-up for new engineers easier: |
| 12 | +all you must do is follow the pattern, not internalize a complex type |
| 13 | +hierarchy. There are obvious places in the code base where replicated patterns |
| 14 | +have been made into abstractions -- we follow the "shape" rule, if you have |
| 15 | +three or more repeats, make a jig -- but we do not start there. |
| 16 | + |
| 17 | +# Testing |
| 18 | + |
| 19 | +Where possible lading prefers property tests over unit tests and in especially |
| 20 | +critical components we require proofs. We use |
| 21 | +[proptest](https://github.com/proptest-rs/proptest) in this project for property |
| 22 | +tests and the [kani](https://github.com/model-checking/kani) proof tool. |
| 23 | + |
| 24 | +# Design Goals |
| 25 | + |
| 26 | +Lading is a performance tool. It's behavior has consequences on the development |
| 27 | +practices of large number of engineers and so lading must be: |
| 28 | + |
| 29 | +* strictly 'faster' than targets, users must not wonder if their target has hit |
| 30 | + a bottleneck or lading has, |
| 31 | +* deterministic, targets must receive the same load across all instances of |
| 32 | + lading else replication of results is impossible and |
| 33 | +* extensible, lading must be available and capable of being extended for a |
| 34 | + variety of use-cases. |
| 35 | + |
| 36 | +No change is valid to lading that is in conflict with these goals. In specific |
| 37 | +this means that lading will pre-allocate where possible, will explicitly thread |
| 38 | +randomness and other sources of non-determinism into code paths and will |
| 39 | +preference algorithms that have better worst-case behavior. |
| 40 | + |
| 41 | +Lading is written to be as easy to contribute to as possible. We ask that any |
| 42 | +dependency used in the project in more than one crate be present in the |
| 43 | +top-level Cargo.toml and be referenced from the workspace in sub-crates. |
| 44 | + |
| 45 | +# Workflow |
| 46 | + |
| 47 | +Changes to lading are subject this flow: |
| 48 | + |
| 49 | +* `cargo check` |
| 50 | +* `cargo clippy` |
| 51 | +* `cargo nextest run` |
| 52 | + |
| 53 | +Proofs must be run with the `cargo kani` tool in the crate where proofs reside. |
0 commit comments