mirror of
https://github.com/hercules-ci/flake-parts.git
synced 2024-12-14 11:47:31 +00:00
CONTRIBUTING.md: More rules on request
This commit is contained in:
parent
7b027db864
commit
df88875d39
1 changed files with 30 additions and 8 deletions
|
@ -14,18 +14,18 @@ Step 3. If needed, create a PR. Make sure to run `nix-shell` before comitting. I
|
||||||
|
|
||||||
# Style
|
# Style
|
||||||
|
|
||||||
Rule #1. Go with the flow. Write code that fits in. Don't reformat existing code. Don't obsess over fitting in. Write good docs and tests instead.
|
This repository is written in a style similar to that of Nixpkgs, with some exceptions.
|
||||||
|
The following sections describe such additions, exceptions, and it probably confirms some rules.
|
||||||
|
|
||||||
|
## Rule #1. Go with the flow
|
||||||
|
|
||||||
|
Write code that fits in. Don't reformat existing code. Don't obsess over fitting in. Write good docs and tests instead.
|
||||||
|
|
||||||
|
## Camel case
|
||||||
|
|
||||||
This repository is written in a style similar to that of Nixpkgs, with some exceptions
|
|
||||||
|
|
||||||
- File names may be in camelCase. This reduces the number of unique names in the project.
|
- File names may be in camelCase. This reduces the number of unique names in the project.
|
||||||
|
|
||||||
- The "contains attribute" operator is spelled without spaces, just like the "select attribute" operator. I believe Nixpkgs is undecided on this.
|
|
||||||
```nix
|
|
||||||
if x?a then "has a" else "does not have a"
|
|
||||||
# ^^^
|
|
||||||
```
|
|
||||||
|
|
||||||
Except for file names, the Nixpkgs casing rule is maintained here as well:
|
Except for file names, the Nixpkgs casing rule is maintained here as well:
|
||||||
|
|
||||||
- Package names are verbatim or in snake-case. Example:
|
- Package names are verbatim or in snake-case. Example:
|
||||||
|
@ -34,3 +34,25 @@ Except for file names, the Nixpkgs casing rule is maintained here as well:
|
||||||
- Functionality provided by flake-parts is in camelCase. Examples:
|
- Functionality provided by flake-parts is in camelCase. Examples:
|
||||||
- `getSystem`
|
- `getSystem`
|
||||||
- `mkFlake`
|
- `mkFlake`
|
||||||
|
|
||||||
|
## Operators and such
|
||||||
|
|
||||||
|
- The "contains attribute" operator is spelled without spaces, just like the "select attribute" operator. I believe Nixpkgs is undecided on this.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
if x?a then x.a else "does not have a"
|
||||||
|
# ^^^
|
||||||
|
```
|
||||||
|
|
||||||
|
- `@` pattern goes before and uses no extra spaces.
|
||||||
|
|
||||||
|
```nix
|
||||||
|
# immediately before parameter list when single line
|
||||||
|
pair@{ name, value }:
|
||||||
|
|
||||||
|
# newline after @ when multi-line
|
||||||
|
pair@
|
||||||
|
{ name
|
||||||
|
, value
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue