Commit Graph

251 Commits

Author SHA1 Message Date
Brian McGee
4cc7e00488
refine github workflows (#331)
Some checks are pending
gh-pages / build (push) Waiting to run
gh-pages / deploy (push) Blocked by required conditions
golangci-lint / lint (push) Waiting to run
* ci: add golangci-lint workflow

It doesn't conform to the treefmt spec so we run it here to catch any issues.

* ci: switch to buildbot

---------

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-07-03 19:14:42 +01:00
mergify[bot]
45cc82c105
Merge pull request #330 from numtide/feat/cache-fallback
Some checks are pending
gh-pages / build (push) Waiting to run
gh-pages / deploy (push) Blocked by required conditions
Nix Flake Actions / nix-matrix (push) Waiting to run
Nix Flake Actions / nix-build (push) Blocked by required conditions
feat: if we can't open the cache, fallback to no cache
2024-07-03 10:24:53 +00:00
Brian McGee
f266fc863b
feat: if we can't open the cache, fallback to no cache
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-07-03 09:40:46 +01:00
Brian McGee
39bc4464b1
Merge pull request #329 from numtide/reduce-readme
Some checks failed
gh-pages / build (push) Has been cancelled
Nix Flake Actions / nix-matrix (push) Has been cancelled
gh-pages / deploy (push) Has been cancelled
Nix Flake Actions / nix-build (push) Has been cancelled
README: drop unecessary meme
2024-07-02 07:52:53 +01:00
Jörg Thalheim
9da59c7364 run deploy only on main 2024-07-02 07:43:24 +02:00
Jörg Thalheim
871701e184 README: drop unecessary meme
I don't think it adds much value to the project but takes up space and
attention in the README.
At the end of the day, do users care what language something is written
in?
One can implement a rollercoaster in Excel:
https://www.youtube.com/watch?v=IrVA1BBHFHw
2024-07-02 07:08:21 +02:00
Brian McGee
aa9f78b716
feat: remove release constraint on docs deployment
Some checks are pending
gh-pages / build (push) Waiting to run
gh-pages / deploy (push) Blocked by required conditions
Nix Flake Actions / nix-matrix (push) Waiting to run
Nix Flake Actions / nix-build (push) Blocked by required conditions
Need a better story
to keep docs changes for new features away from the website
before they're released,
but in the short term we need
to be able to push out edits and fixes without releasing.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-07-01 20:26:11 +01:00
mergify[bot]
33d2f60701
Merge pull request #325 from numtide/fix/global-excludes
fix: configure toml keys for config fields
2024-07-01 15:52:48 +00:00
mergify[bot]
a77db5291d
Merge branch 'main' into fix/global-excludes 2024-07-01 15:52:15 +00:00
mergify[bot]
c3e3c05128
Merge pull request #326 from numtide/fix/global-excludes-docs
doc: fix global excludes config example
2024-07-01 15:32:59 +00:00
mergify[bot]
e1f16c8370
Merge branch 'main' into fix/global-excludes-docs 2024-07-01 15:32:26 +00:00
Brian McGee
2e05603d1e
fix: configure toml tags for config fields
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-07-01 16:30:34 +01:00
mergify[bot]
e065ac9a2a
Merge pull request #328 from flokli/no-cache-fix
Some checks are pending
gh-pages / build (push) Waiting to run
gh-pages / deploy (push) Blocked by required conditions
Nix Flake Actions / nix-matrix (push) Waiting to run
Nix Flake Actions / nix-build (push) Blocked by required conditions
fix: only try opening the cache if cache is enabled
2024-07-01 14:47:36 +00:00
Florian Klink
601af09772 fix: only try opening the cache if cache is enabled
Otherwise `--no-cache` still fails to open the cache.
2024-07-01 17:40:12 +03:00
Brian McGee
7d7815e1aa
doc: fix global excludes config example
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-07-01 14:30:37 +01:00
mergify[bot]
ab9f831d72
Merge pull request #323 from numtide/feat/blueprint
Some checks are pending
gh-pages / build (push) Waiting to run
gh-pages / deploy (push) Blocked by required conditions
Nix Flake Actions / nix-matrix (push) Waiting to run
Nix Flake Actions / nix-build (push) Blocked by required conditions
feat: use numtide/blueprint instead of flake.parts
2024-06-30 11:26:54 +00:00
mergify[bot]
ff5380aaa2
Merge branch 'main' into feat/blueprint 2024-06-30 11:26:22 +00:00
Brian McGee
aea75cdeb1
feat: remove CGO dependencies and disable
Not required

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-30 12:25:00 +01:00
Brian McGee
986f020c3d
feat: use numtide/blueprint instead of flake.parts
Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-30 12:25:00 +01:00
mergify[bot]
492083b03e
Merge pull request #322 from isbecker/docs/treefmt-vscode
Some checks failed
gh-pages / build (push) Has been cancelled
Nix Flake Actions / nix-matrix (push) Has been cancelled
gh-pages / deploy (push) Has been cancelled
Nix Flake Actions / nix-build (push) Has been cancelled
docs: adds information regarding IDE integration in vscode
2024-06-28 19:25:34 +00:00
Ian Becker
e02f853229 docs: adds information regarding IDE integration in vscode 2024-06-25 15:46:27 -04:00
Brian McGee
30d30b54f0
Merge pull request #321 from numtide/softer-cancel
Softer cancel
2024-06-15 11:28:48 +01:00
zimbatm
e29107d3ee fix: only cancel formatters on background errors
If any of the formatting action returns an error, keep going to surface
as many errors as possible.

If the user hits Ctrl-C then terminate everything.
2024-06-15 11:57:57 +02:00
Brian McGee
4e8daacca3
Merge pull request #320 from numtide/golangci-lint
chore: do a golangci-lint pass
2024-06-14 14:20:32 +01:00
zimbatm
c68261e979 fix: stop hard-killing formatters
Give the processes some chance to clean after themselves.

Fixes https://github.com/numtide/treefmt/issues/316#issuecomment-2160628891
2024-06-14 14:11:23 +02:00
Jonas Chevalier
6b591255b1
test: add tests for glob matching (#319)
This helps demonstrate how our globbing works.
2024-06-14 12:57:51 +02:00
zimbatm
6d6a71a3ca chore: do a golangci-lint pass
golangci-lint doesn't follow the treefmt spec so it can't be integrated
with treefmt unfortunately.
2024-06-14 12:32:57 +02:00
mergify[bot]
251012657a
Merge pull request #318 from numtide/feat/improve-unmatched
feat: improve unmatched logic
2024-06-14 09:36:20 +00:00
Brian McGee
56d8561125
feat: improve unmatched logic
Separates global excludes processing from `Formatter.Wants`. This removes redundant processing of global excludes in each `Formatter.Wants` call.

If a file has been globally excluded, we do not emit an `on-unmatched` log message. This should help reduce as reported in #317.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-14 10:31:47 +01:00
mergify[bot]
2ca613901d
Merge pull request #315 from numtide/dependabot/github_actions/goreleaser/goreleaser-action-6
chore(deps): bump goreleaser/goreleaser-action from 5 to 6
2024-06-11 07:56:04 +00:00
dependabot[bot]
57b907d99d
chore(deps): bump goreleaser/goreleaser-action from 5 to 6
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5 to 6.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v5...v6)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-10 17:55:16 +00:00
mergify[bot]
51640c85d3
Merge pull request #314 from katexochen/cli-no-global-state
cli: remove global state, init function usage
2024-06-07 08:16:03 +00:00
Paul Meyer
c07305e6b0 cli: remove global state, init function usage
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2024-06-06 20:28:37 +02:00
Brian McGee
ab2b373094
Merge pull request #313 from numtide/fix/stdin
fix: --stdin flag
2024-06-05 15:13:52 +01:00
Brian McGee
089eb171a0
fix: --stdin flag
This was incorrectly ported from Rust to Go.

When `--stdin` is provided, `treefmt` copy the `stdin` into a temporary file, using the first path argument as the filename. This allows the user to control which formatters will match this temp file based on their `treefmt` config.

After the formatters have been applied, the contents of this temporary file are then printed to stdout and the temp file is removed.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-05 15:06:10 +01:00
Brian McGee
4f086c204e
Revert "fix: --stdin flag"
This reverts commit 9934a5764d.
2024-06-04 17:05:56 +01:00
Brian McGee
9934a5764d
fix: --stdin flag
This was incorrectly ported from Rust to Go.

When provided, `treefmt` will take the contents of stdin and place them into the file provided with the `--stdin` flag, then format it according to the configured formatters.

If the file doesn't exist it is created. If it exists, it is first truncated and then populated with stdin.

Signed-off-by: Brian McGee <brian@bmcgee.ie>
2024-06-03 17:07:34 +01:00
mergify[bot]
2454542a36
Merge pull request #309 from numtide/find-tree-root
cli: search for the tree root by default
2024-05-30 18:09:47 +00:00
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