Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Run treefmt in CI #19

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions .github/workflows/treefmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: treefmt
on: [push, pull_request]
jobs:
formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: treefmt
run: nix-shell
--packages
treefmt
nixpkgs-fmt
shfmt
shellcheck
black
nodePackages.prettier
codespell
--command "treefmt --fail-on-change --no-cache"
2 changes: 1 addition & 1 deletion content/news/release-2.7.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ for your input on this release.

- add templatefile() helper
- add lib.tf
- add referencable functor
- add referenceable functor
4 changes: 2 additions & 2 deletions content/options/json_converter.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env bash

cat "$1" | jq 'to_entries | .[] | {
jq 'to_entries | .[] | {
label : .key,
type : .value.type,
description : .value.description,
example: .value.example | tojson,
default: .value.default | tojson,
defined: .value.declarations[0].path,
url: .value.declarations[0].url,
}' | jq -s
}' "$1" | jq -s
11 changes: 7 additions & 4 deletions treefmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ includes = [ "*.nix"]
[formatter.shell]
command = "shfmt"
options = [
"-i",
"2", # indent 2
"-s", # simplify the code
"-w", # write back to the file
"--indent=2",
"--simplify",
"--write",
]
includes = ["*.sh"]

Expand All @@ -31,3 +30,7 @@ includes = [
"*.yaml",
"*.yml",
]

[formatter.spelling]
command = "codespell"
includes = ["*.md"]