Skip to content

Commit

Permalink
[RFC 0166] Nix formatting, take two (#166)
Browse files Browse the repository at this point in the history
* 166: Nix formatting

Create 0101-nix-formatting.md

WIP

Go through a large part and agree on it

Co-Authored-By: @piegamesde

Update 0101-nix-formatting.md

Rework a lot of things

Update 0101-nix-formatting.md

Move around some sections

Reword the detailed section

Minor updates

Slight header changes again

Updates

Update 0101-nix-formatting.md

Update after today's meeting

Update 0101-nix-formatting.md

Further updates in the meeting

Update 0101-nix-formatting.md

After todays meeting

Update after meeting

Rename to probably the right number

Only use anchor links

Improvements and additions

- The sub-expression rule is now reworded and its own section with
  examples and rationale
- Line length limit is now specified as we agreed-upon in the meeting
- The operator section is rewritten to align more with the consensus

Redo and explain operator special case

Also remove the special case for non-chainable operators, barely any benefit
in Nixpkgs

* Operator chains outside bindings can also have a compact form

* Make the operator compact form specific to binders

* Fix accidentally formatted semicolons in alternatives

* Minor changes

* Light copy editing

* Fix .git-blame-ignore-revs

* Improve assert/with wording

* Be more flexible with single-line element count

* binder -> binding

* unindent inherit semicolon, reshuffle binding/inherit sections (#14)

* unindent inherit semicolon, reshuffle binding/inherit sections

* fixup! Stuff

* Give alternatives to `in` formatting

* Expand on line break preservation

* Add editorconfig

* Expand argumentation against leading commas

* Add @dasJ to the formatter team

* Add shepherd team

Co-authored-by: Linus Heckemann <[email protected]>

* Various improvements (#15)

* Various improvements

- Remove unnecessary **Description** headers
- Rename **Rationale and Alternatives** to just **Alternatives**
- Insert must/may/should more diligently
- Add some TODOs where things are unclear
- Remove numberings from examples when not needed
- Minor clarity improvements and simplifications throughout

* Apply suggestions from code review

Co-authored-by: Ryan Hendrickson <[email protected]>

---------

Co-authored-by: Ryan Hendrickson <[email protected]>

* Address TODOs and rework with/assert

* Minor adjustments

* Mention formatting Nix code in documentation

* Working towards finalization (#16)

- Defined absorption and absorbable terms
- Adapted the existing RFC text to make use of these definitions,
  resulting in simplications of the text in many cases.
- Updated `with` section to match the implementation
- Updated the function declaration section to match the implementation
  - Sometimes, the function body may get absorbed
  - This used to be a special case scoped to bindings only, so it got removed there
- Updated the operators section to match the implementation
  - Specify the format of non-chainable operators (somehow those got lost in the past)
- Reworked bindings section. It should now be clear and specific enough.
- Minor wording fixes

* String section

* Specify assert conditions

* More absorption for multi-line arguments

* How to update the standard format

* Fix minor typos

* Less lines for common function call patterns

* Specify comments

* Specify that the formatter should be as pure as possible

With some exceptions

* nit: fix list concatenation example (#17)

* Update rfcs/0166-nix-formatting.md

Co-authored-by: Doron Behar <[email protected]>

* Add good indentation examples (#18)

* Add another chainable operators example

* justify difference in semicolon placement

* Allow different parenthesized argument style

* Clarify non-vertical alignment rule

* Improved clarity of bindings rule

* Improve bindings semicolon alternatives section

---------

Co-authored-by: Silvan Mosberger <[email protected]>
Co-authored-by: Silvan Mosberger <[email protected]>
Co-authored-by: Ryan Hendrickson <[email protected]>
Co-authored-by: Yuriy Taraday <[email protected]>
Co-authored-by: Linus Heckemann <[email protected]>
Co-authored-by: Janne Heß <[email protected]>
Co-authored-by: Doron Behar <[email protected]>
  • Loading branch information
8 people authored Mar 5, 2024
1 parent e4c27fd commit 5d5eef7
Showing 1 changed file with 1,735 additions and 0 deletions.
Loading

0 comments on commit 5d5eef7

Please sign in to comment.