Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC 101 style #2

Open
wants to merge 158 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
d2cc629
Apply hlint suggestions
Lucus16 Apr 6, 2023
d83a00c
Generalize parsing utilities
Lucus16 Apr 6, 2023
c8ebd02
Attach leading trivia to next token
Lucus16 Apr 6, 2023
0c9d9a4
Add test for if-with-comments
Lucus16 Apr 6, 2023
f702d73
Fix argument order in Ann
Lucus16 Apr 6, 2023
5ae8e62
Allow standalone comments in lists and sets
Lucus16 Apr 29, 2023
4a05494
Add direnv
piegamesde May 5, 2023
13b7904
Update CLI flags description
piegamesde May 5, 2023
f938cfc
Add simple test runner
piegamesde May 5, 2023
9ce4ce3
Rework function declarations
piegamesde Apr 18, 2023
e05d6a2
Force-expand lists with more than one item
piegamesde Apr 18, 2023
305ed77
Expand let statements more
piegamesde Apr 18, 2023
73e7ec4
Rework if statements
piegamesde Apr 18, 2023
cd0acd3
Don't indent `in` body anymore
piegamesde May 5, 2023
8315ca3
Rework `inherit` statements
piegamesde May 5, 2023
28a54b3
fixup! Rework if statements
piegamesde May 5, 2023
7fe6a99
Add some code documentation
piegamesde May 5, 2023
e9cdac6
Rework bindings
piegamesde May 5, 2023
2e2797a
Tests: replace diff/idioms_pkgs_3
piegamesde May 7, 2023
dafec15
fixup! Rework bindings
piegamesde May 7, 2023
de7bd6d
Expand singleton lists with a multiline item
piegamesde May 7, 2023
d1ba3cd
Test: add idioms_nixos_2
piegamesde May 7, 2023
34c119e
Fix typo in README.md
wbehrens-on-gh May 16, 2023
e6bed2a
Don't absort `in` body anymore
piegamesde May 17, 2023
a226b6d
Improve group handling for bindings and inherit
piegamesde May 18, 2023
0528d78
Special case selection operator
piegamesde May 18, 2023
b3e7d0e
Merge pull request #124 from wbehrens-on-gh/patch-1
rvem May 19, 2023
8a6cb8c
Rework operators
piegamesde May 19, 2023
487d313
Rework parentheses
piegamesde May 19, 2023
6ce18ad
Rework function calls
piegamesde May 19, 2023
3802eaa
Add direnv
piegamesde May 5, 2023
7c18e90
Merge branch 'leading-comments' into rfc101-style
piegamesde May 19, 2023
10745f3
Fix function commas
piegamesde May 19, 2023
20d35b3
Move comments around a bit
piegamesde May 20, 2023
2a9ec6b
Tweak operations some more
piegamesde May 20, 2023
cb309e4
wip
piegamesde May 21, 2023
6f4791d
pretty parentheses
piegamesde May 21, 2023
8d07dc9
stupid silly bug
piegamesde May 21, 2023
b1b9313
Absorb parenthesized abstractions with multiple arguments
piegamesde Jun 6, 2023
0b26acb
Tweak operations some more
piegamesde Jun 6, 2023
3e16d20
Don't force-expand (simple) if statements anymore
piegamesde Jun 6, 2023
db2c938
Special case binary operators
piegamesde Jun 6, 2023
66ac4b4
Improve error message on verify
piegamesde Jun 8, 2023
5a8eb61
Improve layouting algorithm
piegamesde Jun 8, 2023
eeb2534
Factor out function application code
piegamesde Jun 8, 2023
792c405
Infinisil style function application
piegamesde Jun 9, 2023
b7daac9
Improve comment handling
piegamesde Jun 10, 2023
b86d8ea
Unindent semicolons again
piegamesde Jun 14, 2023
9a6cc7f
Don't absorb lambda body
piegamesde Jun 14, 2023
3da135d
Absorb parenthesized function calls again
piegamesde Jun 14, 2023
c198bda
float's can't start with just exponents
yorickvP May 5, 2023
b3ac0a8
Merge pull request #123 from serokell/fix-e2fsprogs
yorickvP Jun 16, 2023
66b6712
Binder with with: absorb less
piegamesde Jun 22, 2023
5bb0639
Rework sets and lists
piegamesde Jun 23, 2023
f7cf76f
Force-spread inherit with more than three items
piegamesde Jun 23, 2023
a7dc8bb
Binder: Always absorb strings and paths
piegamesde Jun 23, 2023
4e1ff44
Tests: add lib/systems/parse.nix
piegamesde Jun 23, 2023
c926692
Better trailing comment parsing
piegamesde Jun 22, 2023
c2702df
Function application: fix edge case
piegamesde Jun 24, 2023
538663c
Function application: don't always absorb last argument
piegamesde Jun 24, 2023
325305e
Binders: force-expand nested attribute sets
piegamesde Jun 25, 2023
a95bd3a
Abstraction: don't absorb body when there are more than two parameters
piegamesde Jun 25, 2023
32609c8
Ignore comments in line length calculation
piegamesde Jun 25, 2023
c568bfa
Ignore indentation in line length calculation
piegamesde Jun 25, 2023
1e42aa2
Merge remote-tracking branch 'upstream/master' into rfc101-style
piegamesde Jun 26, 2023
e6693ca
Absorb abstraction in binder
piegamesde Jul 4, 2023
3b26c7d
Improve mapFirstToken code style
piegamesde Jul 8, 2023
4c0007e
Tests: Add check-meta.nix
piegamesde Jul 9, 2023
ef310bb
Improved helper functions
piegamesde Jul 17, 2023
a54a01a
Improve priority group handling
piegamesde Jul 12, 2023
c4bfa2c
Rework `//` operator
piegamesde Jul 9, 2023
81d3cf8
Copy special cases over to `++` operator
piegamesde Jul 13, 2023
cc5b426
Introduce support for optional trailing commas
piegamesde Jul 17, 2023
4468e9b
Expand attrset function parameters less
piegamesde Jul 16, 2023
9ac66a9
Rework renderer again
piegamesde Jul 18, 2023
a93dcf7
Binders: be more selective about semicolon placement
piegamesde Jul 17, 2023
43dd01d
Fix comment handling
piegamesde Sep 28, 2023
1100f8e
[OPS-1448] Replace buildkite with github actions
Sereja313 Sep 27, 2023
6cdba9e
Merge pull request #134 from serokell/sereja/OPS-1448-bk-to-ga
Sereja313 Oct 9, 2023
ca9c897
Don't touch files if they don't need changing
piegamesde Sep 25, 2023
6e6385f
Merge pull request #133 from serokell/piegames/fix-mtime
infinisil Oct 9, 2023
549541f
Expand singleton lists again
piegamesde Oct 10, 2023
7649a1b
Put semicolons on same line again
piegamesde Oct 11, 2023
edf4757
[Chore] Remove cachix cache mentions
rvem Oct 25, 2023
71936d4
[Chore] Update build status badge in README
rvem Oct 25, 2023
141b9b1
Merge pull request #138 from serokell/rvem/remove-cachix-mentions
infinisil Oct 26, 2023
f283c26
Document release process
piegamesde Sep 23, 2023
981b1d7
Relax dependency version bounds
piegamesde Sep 23, 2023
79495e6
Update Nix dependencies
piegamesde Oct 2, 2023
f6e7e80
Fix TypeOperators warning
infinisil Oct 31, 2023
6d0f143
Export missing symbols
infinisil Oct 31, 2023
8b6ccc6
Bump version to 0.6.0
piegamesde Sep 6, 2023
7e9e06e
Merge pull request #132 from serokell/release
infinisil Oct 31, 2023
df9bda0
Parse inherit names with quotes
piegamesde Nov 10, 2023
522bfc6
Merge pull request #141 from piegamesde/quote-inherit
infinisil Nov 13, 2023
8645a22
Update the default line length to 100
piegamesde Jun 23, 2023
d2d4a54
Tests: add make-derivation.nix
piegamesde Nov 17, 2023
8a5109b
Types: introduce mapLastToken
piegamesde Nov 17, 2023
55aae75
Function declarations: fixup commas and comments more
piegamesde Nov 17, 2023
91acfa0
Tests: add interpolation test
piegamesde Nov 29, 2023
064bf4d
String interpolations: Ignore line length limits
piegamesde Nov 17, 2023
9d7317f
String interpolations: compact function applications
piegamesde Nov 18, 2023
46d12b2
Function application: Compact simple functions
piegamesde Nov 18, 2023
62fe12f
String interpolations: Fix indentation
piegamesde Nov 18, 2023
951261e
Strings: Fix single-line strings with double single quotes
piegamesde Nov 29, 2023
136edf4
Inherit: Indent trailing semicolon again
piegamesde Nov 29, 2023
206653b
List, Attrset: Remove surrounding spaces
piegamesde Nov 29, 2023
27ce996
Fix idempotency, enable --verify in tests
piegamesde Dec 1, 2023
21ef16e
Move some more comments up
piegamesde Dec 1, 2023
f29b7be
[Chore] Update "actions/checkout"
rvem Dec 12, 2023
fda8afa
Function application: Fix indentation with multiline function arguments
piegamesde Dec 10, 2023
0a8c246
Revert "List, Attrset: Remove surrounding spaces"
piegamesde Dec 13, 2023
422b1ae
Merge pull request #144 from serokell/update-checkout-action
rvem Dec 14, 2023
35da232
Strings: Fix multi-line strings that end with a single quote
piegamesde Jan 3, 2024
a273e5a
Lists: Fix absorbtion rules
piegamesde Jan 8, 2024
070063e
Assert: always force-expand
piegamesde Jan 15, 2024
53c7361
Rework: with, paramAttr, bindings, parentheses
piegamesde Jan 15, 2024
067c281
Force-expand attrsets in attrset functions
piegamesde Jan 15, 2024
d6930fd
Refactoring
piegamesde Jan 23, 2024
08fe739
Fix false positive in --verify checks
piegamesde Feb 3, 2024
bb45962
Treat some parenthesized expressions as "simple"
piegamesde Feb 2, 2024
a75658d
Strings: Don't normalize anymore
piegamesde Feb 4, 2024
543b65f
WIP: Automatically minimize verification failures
piegamesde Feb 4, 2024
5ab9430
Relax dependency version bounds
piegamesde Sep 23, 2023
887a40d
Update Nix dependencies
piegamesde Oct 2, 2023
6cfbc2c
Fix TypeOperators warning
infinisil Oct 31, 2023
bbe0ba5
Improve multiline asserts
piegamesde Feb 6, 2024
eb732b1
Rework indentation handling
piegamesde Feb 5, 2024
62b0c39
Small cleanup
piegamesde Feb 6, 2024
d1067e4
Predoc: Support multiple priority groups
piegamesde Feb 6, 2024
7b1fcf5
Function application: Expand non-last arguments when rest fits onto a…
piegamesde Feb 6, 2024
a273a47
Add some tests
piegamesde Feb 7, 2024
9ec2ac0
If: Move trailing comments around
piegamesde Feb 24, 2024
aa85d38
Predoc: Prevent trailing whitespace on lines
piegamesde Feb 26, 2024
d531cef
With: Don't absorb when there is a trailing comment
piegamesde Feb 25, 2024
8f4bf7e
Abstraction: Don't absorb when there is a trailing comment
piegamesde Feb 26, 2024
3b95476
Binding: Small refactoring & add test
piegamesde Feb 26, 2024
bcbf8c6
Binding: Don't absorb // and ++ when there is a trailing comment
piegamesde Feb 26, 2024
d6902b0
Fix indentation
piegamesde Feb 25, 2024
6413a12
List, Attrset: Preserve empty line when there are no items
piegamesde Feb 24, 2024
6bd07b5
Fix parenthesized function application
piegamesde Feb 26, 2024
22fa00e
Parentheses: Move trailing comments up and in
piegamesde Feb 26, 2024
f7d9cfe
Application: add some special cases
piegamesde Feb 26, 2024
25792d4
Comments: use RFC style
piegamesde Mar 1, 2024
2b5ee82
String interpolation: Indentation fixes
piegamesde Mar 1, 2024
c477950
readme: Add status note
infinisil Mar 12, 2024
5ee28fc
Create team document
infinisil Mar 13, 2024
be7b6f8
Merge pull request #156 from NixOS/team
infinisil Mar 13, 2024
4e2a748
Merge pull request #154 from NixOS/status-note
infinisil Mar 13, 2024
d5e91da
ci: remove deploy and fix after repo transfer
infinisil Mar 13, 2024
52295a3
Remove webdemo
Sereja313 Mar 13, 2024
5d72795
Merge pull request #160 from NixOS/clean-ci
infinisil Mar 13, 2024
0c2fb12
Merge pull request #162 from NixOS/sereja/remove-webdemo
infinisil Mar 13, 2024
7d99e0b
Merge branch 'master' into rfc101-style
infinisil Mar 13, 2024
4eb99c1
Use /usr/bin/env shebang in tests
infinisil Mar 13, 2024
08b34c0
Comply with REUSE
infinisil Mar 13, 2024
f43ec86
Remove accidentally committed file
infinisil Mar 13, 2024
8d13b59
Parser: Fix operator parsing
piegamesde Mar 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions .buildkite/pipeline.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 piegames <[email protected]>
# SPDX-License-Identifier: MPL-2.0

use_nix
26 changes: 26 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# © 2019-2023 Serokell <[email protected]>
# © 2019-2023 Lars Jellema <[email protected]>
#
# SPDX-License-Identifier: MPL-2.0

name: CI
on:
pull_request:
push:
branches:
- master

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v26

- name: reuse lint
run: nix shell .#packages.x86_64-linux.reuse -c reuse lint

- name: build nixfmt
run: nix build -L .#nixfmt-static
if: success() || failure()
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/dist-newstyle
/.ghc.environment.*
/result
/.direnv
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Copyright: 2019 Serokell <[email protected]>
2019 Lars Jellema <[email protected]>
License: MPL-2.0

Files: test/diff/*
Copyright: 2024 piegames <[email protected]>
License: MPL-2.0

Files: test/correct/*
Copyright: 2022 Serokell <[email protected]>
2022 Lars Jellema <[email protected]>
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@

## Unreleased

* Parsing fixes
* Quotes in inherit statements (like `inherit "or";`) are now supported.

## 0.6.0 -- 2023-10-31

* Fix escaping of interpolations after dollar signs.
* Fix nixfmt trying to allocate temp files that aren't used.
* Don't write if files didn't change, fixing treefmt compatibility
* Nixfmt now accepts the '-' argument to read from stdin.
* `nixfmt [dir]` now recursively formats nix files in that directory.
* Float and int literal parsing now matches nix.
Expand Down
14 changes: 14 additions & 0 deletions MAINTENANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!-- © 2023 piegames <[email protected]>
-
- SPDX-License-Identifier: MPL-2.0
-->

# Maintainer documentation

## Making a new release

- Check the commit log if anything is missing from the change log.
- Check dependency versions in `nixfmt.cabal`, bump upper bounds if possible.
- Bump the version.
- Give it a git tag.
- Upload to hackage using `cabal sdist`. See https://hackage.haskell.org/upload for details.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

You are encouraged to test this out on your code and submit any undesirable formatting you find as an issue

[![Build Status](https://badge.buildkite.com/b37f73adea391439e63288e8fd3b47f4b98fb9640bb864ccfa.svg)](https://buildkite.com/serokell/nixfmt)
[![Cachix](https://img.shields.io/badge/cachix-nixfmt-blue.svg)](https://nixfmt.cachix.org)
![Build Status](https://github.com/serokell/nixfmt/actions/workflows/main.yml/badge.svg?branch=master)

## State

`nixfmt` will form the basis for the initial official standard Nix formatter, as established by [RFC 166](https://github.com/NixOS/rfcs/pull/166).

The established standard Nix formatting differs considerably from the original one. Be aware of this if you track the main branch. Until the first new release the main branch should be considered **very unstable**.

For more details, see the [RFC implementation tracking issue](https://github.com/serokell/nixfmt/issues/153).

## Installation

Expand All @@ -21,8 +28,6 @@ You are encouraged to test this out on your code and submit any undesirable form

- To get the most recent version, install from master:

# Optional: use cachix to get cached builds even for master
cachix use nixfmt
nix-env -f https://github.com/serokell/nixfmt/archive/master.tar.gz -i

- Nix with flakes
Expand All @@ -47,15 +52,10 @@ Haskell dependencies will be built by Cabal.

## Usage

* `nixfmt < input.nix` – reads Nix code form `stdin`, formats it, and outputs to `stdout`
* `nixfmt < input.nix` – reads Nix code from `stdin`, formats it, and outputs to `stdout`
* `nixfmt file.nix` – format the file in place


## For Contributors

We welcome issues and pull requests on GitHub.


## About Serokell

`nixfmt` is maintained and funded with :heart: by
Expand Down
Loading