Commit Graph

263 Commits

Author SHA1 Message Date
mergify[bot]
ed2960d9b2
Merge branch 'main' into find-tree-root 2024-05-30 18:09:15 +00:00
zimbatm
7f4697fc49 simplify logic 2024-05-30 19:56:26 +02:00
zimbatm
bc89625cb9 fix TreeRootFile type
kong resolves path types to absolute paths
2024-05-30 19:44:17 +02:00
zimbatm
bc928bdf2b fixup! Update cli/cli.go 2024-05-30 19:31:31 +02:00
mergify[bot]
3f44ec4542
Merge pull request #307 from numtide/docs-pass
docs: some small changes
2024-05-30 17:23:06 +00:00
Jonas Chevalier
e368d3ee80
Update docs/configure.md
Co-authored-by: Brian McGee <brian@bmcgee.ie>
2024-05-30 19:19:57 +02:00
Jonas Chevalier
f9a464ce5e
Update docs/configure.md
Co-authored-by: Brian McGee <brian@bmcgee.ie>
2024-05-30 19:19:51 +02:00
zimbatm
0511e9acf1 fixes https://github.com/numtide/treefmt/pull/309#discussion_r1620949820 2024-05-30 19:17:57 +02:00
Jonas Chevalier
088479eb27
Update cli/cli.go
Co-authored-by: Brian McGee <brian@bmcgee.ie>
2024-05-30 19:10:07 +02:00
zimbatm
bd32d36a33 cli: search for the tree root by default
Restore the treefmt 1.x behaviour where it would search for the tree
root by recursively searching for the treefmt.toml file up the
filesystem, starting from the current directory.

The `--tree-root-file` option will be useful to remove this bash wrapper: 2fba33a182/module-options.nix (L116-L135)

Fixes #308
2024-05-30 15:46:00 +02:00
zimbatm
2575f2e143 docs: put motivation first
Explain why this project exists, before diving into it
2024-05-30 14:26:38 +02:00
zimbatm
7792121c95 docs: link to treefmt-nix instead of duplicating the examples 2024-05-30 14:26:38 +02:00
zimbatm
fccb46367c docs: focus on the default experience in the quickstart
Most of the time you don't need the extra running options.
2024-05-30 14:26:38 +02:00
zimbatm
93955bbc3c docs: document the global format 2024-05-30 14:26:38 +02:00
Brian McGee
022398399f
fixup! feat: configure goreleaser to mark releases as pre-release (#305)
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 15:25:07 +01:00
Jonas Chevalier
7afdc7a3ee
Merge pull request #303 from numtide/feat/show-unmatched
--on-unwatched
2024-05-29 12:05:21 +02:00
Brian McGee
bbe50fbe75
doc: refine --on-unmatched usage
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 10:32:02 +01:00
Brian McGee
1b517c6502
feat: add --on-unmatched
By default, if a path does not match any formatter a log message at WARN level will be emitted. A user can change this by providing the `--on-unmatched` or `-u` flag and specifying a log level `debug,info,warn,error,fatal`.

If fatal, the process will exit with an error on the first unmatched path encountered.

Closes #302

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 10:32:02 +01:00
Brian McGee
6cf9524aa7
fix: cleanup cwd change in deterministic pipeline test 2024-05-29 10:32:02 +01:00
Brian McGee
6c7fd57b5c
fix: remove config2 alias in format_test.go
It's unnecessary.
2024-05-29 10:32:02 +01:00
Brian McGee
53b0dc5536
feat: configure goreleaser to mark releases as pre-release (#305)
This is to prevent noise until we have a stable 2.x

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 09:23:54 +02:00
Brian McGee
ff957c5f1a
fix: restrict github pages publication to published releases (#304)
We currently publish an update when we merge to `main`. This means new functionality that is not yet released is being talked about on the docs site.

This restricts deploying to github pages to only published releases.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-29 09:23:34 +02:00
mergify[bot]
06f15f4237
Merge pull request #301 from numtide/feat/better-concurrency-model
feat: simplify pipeline model
2024-05-26 20:11:48 +00:00
Brian McGee
ce14ee828f
feat: simplify pipeline model
For each path we determine the list of formatters that are interested in formatting it. From there, we sort
the list of formatters first by priority (lower value, higher priority) and then by name (lexicographically).

With this information we create a batch key which is based on the unique sequence of formatters. When enough paths with the same sequence is ready we apply them in order to each formatter.

By default, with no special configuration, this model guarantees that a given path will only be processed by one formatter at a time.

If a user wishes to influence the order in which formatters are applied they can use the priority field.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-26 16:52:04 +01:00
mergify[bot]
6ce3d27519
Merge pull request #300 from numtide/dependabot/github_actions/cachix/install-nix-action-27
chore(deps): bump cachix/install-nix-action from 26 to 27
2024-05-21 10:59:39 +00:00
dependabot[bot]
af5d2eb375
chore(deps): bump cachix/install-nix-action from 26 to 27
Bumps [cachix/install-nix-action](https://github.com/cachix/install-nix-action) from 26 to 27.
- [Release notes](https://github.com/cachix/install-nix-action/releases)
- [Commits](https://github.com/cachix/install-nix-action/compare/v26...V27)

---
updated-dependencies:
- dependency-name: cachix/install-nix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-21 10:58:40 +00:00
Brian McGee
533f4e2f0e
Merge pull request #299 from numtide/dependabot/github_actions/cachix/cachix-action-15
chore(deps): bump cachix/cachix-action from 14 to 15
2024-05-21 11:58:04 +01:00
dependabot[bot]
105536b24f
chore(deps): bump cachix/cachix-action from 14 to 15
Bumps [cachix/cachix-action](https://github.com/cachix/cachix-action) from 14 to 15.
- [Release notes](https://github.com/cachix/cachix-action/releases)
- [Commits](https://github.com/cachix/cachix-action/compare/v14...v15)

---
updated-dependencies:
- dependency-name: cachix/cachix-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-20 17:38:26 +00:00
Jonas Chevalier
a969e31956
docs: clearer landing page (#298)
I tried to make it clearer for fresh eyes what this project is about
2024-05-18 09:45:38 +02:00
mergify[bot]
a20db207db
Merge pull request #297 from numtide/feat/error-when-path-matches-multiple-formatters
Error out when a path matches multiple formatters
2024-05-17 11:06:38 +00:00
Brian McGee
06e41453ec
feat: error out when a path matches multiple formatters
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 11:55:31 +01:00
mergify[bot]
4199706ddd
Merge pull request #296 from numtide/feat/switch-to-treefmt-nix
feat: switch back to numtide/treefmt-nix
2024-05-17 10:26:58 +00:00
Brian McGee
affbb99ef9
feat: switch back to numtide/treefmt-nix
It now supports freeform type for settings allowing us to pass through pipeline options.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 11:19:48 +01:00
mergify[bot]
8f427c6633
Merge pull request #295 from numtide/feat/improve-logging
feat/improve logging
2024-05-17 10:17:24 +00:00
mergify[bot]
3b3828251f
Merge branch 'main' into feat/improve-logging 2024-05-17 10:16:51 +00:00
Brian McGee
c002eca8b7
feat: log out when a path is not matched to any formatter
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 10:48:53 +01:00
Brian McGee
3c264c623e
feat: log out the formatter command being applied at debug level
Closes #292

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 10:39:15 +01:00
mergify[bot]
567524b625
Merge pull request #294 from numtide/feat/update-modules
Update go modules and fix git issue
2024-05-17 09:30:38 +00:00
Brian McGee
2b94480461
fix: use resolved executable when applying a formatter
We were going to the trouble of resolving the command to an executable via the PATH but were not using that executable when executing the formatting command.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 09:49:41 +01:00
Brian McGee
ff3bfaa0b6
feat: demote some cache related logging to debug level
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 09:43:38 +01:00
Brian McGee
385fbc36cf
feat: improve formatter cache debug logging
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 09:42:07 +01:00
Brian McGee
3649e4789c
fix: support core.untrackedCache in git
Switches go-git to master for now until a new release is cut.

Related to: https://github.com/nix-community/infra/pull/1266

Fixes #293

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 09:38:22 +01:00
Brian McGee
24114f5e0c
feat: update go modules
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-17 09:21:21 +01:00
Brian McGee
80e9b0acda
Merge pull request #290 from numtide/fix/formatters-short-flag
fix: -f short flag for specifying formatters
2024-05-16 06:33:34 +01:00
mergify[bot]
2e032c8d06
Merge pull request #291 from fricklerhandwerk/fix-wording
fix wording
2024-05-16 05:32:55 +00:00
fricklerhandwerk
f7cc274b07 fix wording
the sentence was hard to parse
2024-05-16 00:10:13 +02:00
Brian McGee
4d07521d97
fix: -f short flag for specifying formatters
Preserves backwards compatibility with v1

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-14 20:29:42 +01:00
Brian McGee
54d3cd004c
doc: fix license link in footer
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-13 10:40:02 +01:00
Brian McGee
b8d9e2ac9b
feat: configure numtide binary cache
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-13 10:24:26 +01:00
Brian McGee
c815a21f8d
doc: switch to treefmt.com domain
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-05-13 10:20:22 +01:00