Skip to content

Commit

Permalink
refactor: move lint tasks from just to mise
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Mar 16, 2024
1 parent dae8ece commit 4f78a8c
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- run: cargo build --all-features
- run: ./target/debug/mise settings set experimental true
- run: ./target/debug/mise run render
- run: ./target/debug/mise run lint:fix
- run: ./target/debug/mise run lint-fix
- run: git diff HEAD
- if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'jdx/mise'
uses: EndBug/add-and-commit@v9
Expand Down
19 changes: 10 additions & 9 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ THIS_PROJECT = "{{config_root}}-{{cwd}}"

[tools]
#node = 'lts'
"cargo:eza" = "0.17.0"
"cargo:git-cliff" = "latest"
tiny = { version = "1", foo = "bar" }
golang = { version = "prefix:1.21", foo = "bar" }
python = { version = "latest", virtualenv = "{{env.HOME}}/.cache/venv" }
ruby = "3.1"
python = { version = "latest" }
shellcheck = "0.10"
shfmt = "3"
"npm:prettier" = "3"
"npm:markdownlint-cli" = "0.38"
#python = { version = "latest", virtualenv = "{{env.HOME}}/.cache/venv" }
#ruby = "3.1"

[plugins]
nnnn = 'https://github.com/mise-plugins/rtx-nodejs#main'
Expand All @@ -27,8 +32,8 @@ format = "cargo fmt -- --emit=files"
clean = "cargo clean"
release = "cargo release"
signal-test = "node ./test/fixtures/signal-test.js"
ci = {depends = [ "format", "build", "test" ]}
pre-commit = {depends = ["render", "lint"]}
ci = { depends = ["format", "build", "test"] }
pre-commit = { depends = ["render", "lint"] }
'test:e2e' = "just test-e2e"

[tasks.build]
Expand Down Expand Up @@ -76,10 +81,6 @@ depends = ["render:*"]
description = "Update test snapshots"
run = "cargo insta test --accept --unreferenced delete"

[tasks."lint:fix"]
alias = "lint-fix"
run = "just lint-fix"

[tasks.test]
alias = 't'
run = [
Expand Down
2 changes: 1 addition & 1 deletion .mise/config.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tasks.lint = "just lint"
tasks.l = "mise run lint"
11 changes: 11 additions & 0 deletions .mise/tasks/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euxo pipefail

scripts=("$PWD"/scripts/*.sh "$PWD"/e2e/{test_,run_}* "$PWD"/e2e/*.sh)

cargo clippy -- -Dwarnings
cargo fmt --all -- --check
shellcheck -x "${scripts[@]}"
shfmt -d "${scripts[@]}"
prettier -c $(git ls-files '*.yml' '*.yaml')
markdownlint .
11 changes: 11 additions & 0 deletions .mise/tasks/lint-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash
# mise aliases=["lint:fix"]
set -euxo pipefail

scripts=("$PWD"/scripts/*.sh "$PWD"/e2e/{test_,run_}* "$PWD"/e2e/*.sh)
cargo clippy --fix --allow-staged --allow-dirty -- -Dwarnings
cargo fmt --all
shellcheck -x "${scripts[@]}"
shfmt -w "${scripts[@]}"
prettier -w $(git ls-files '*.yml' '*.yaml')
markdownlint --fix .
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
26 changes: 1 addition & 25 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ default: test
alias b := build
alias e := test-e2e
alias t := test
alias l := lint
alias lf := lint-fix

# just `cargo build`
build *args:
cargo build --all-features {{ args }}

# run all test types
test *args: (test-unit args) test-e2e lint
test *args: (test-unit args) test-e2e

# run the rust "unit" tests
test-unit *args:
Expand Down Expand Up @@ -68,25 +66,3 @@ test-coverage:
fi
echo "::group::Render lcov report"
cargo llvm-cov report --lcov --output-path lcov.info

scripts := "scripts/*.sh e2e/{test_,run_}* e2e/*.sh"

# clippy, cargo fmt --check, and just --fmt
lint:
cargo clippy -- -Dwarnings
cargo fmt --all -- --check
mise x -y shellcheck@latest -- shellcheck -x {{ scripts }}
mise x -y shfmt@latest -- shfmt -d {{ scripts }}
just --unstable --fmt --check
MISE_EXPERIMENTAL=1 mise x -y npm:prettier@latest -- prettier -c $(git ls-files '*.yml' '*.yaml')
MISE_EXPERIMENTAL=1 mise x -y npm:markdownlint-cli@latest -- markdownlint .

# runs linters but makes fixes when possible
lint-fix:
cargo clippy --fix --allow-staged --allow-dirty -- -Dwarnings
cargo fmt --all
mise x -y shellcheck@latest -- shellcheck -x {{ scripts }}
mise x -y shfmt@latest -- shfmt -w {{ scripts }}
just --unstable --fmt
MISE_EXPERIMENTAL=1 mise x -y npm:prettier@latest -- prettier -w $(git ls-files '*.yml' '*.yaml')
MISE_EXPERIMENTAL=1 mise x -y npm:markdownlint-cli@latest -- markdownlint --fix .

0 comments on commit 4f78a8c

Please sign in to comment.