Skip to content
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: mise run ci
- run: mise run ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 5 additions & 4 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-- .luacheckrc configuration for mise-semver plugin

-- Globals defined by the vfox plugin system
-- Globals defined by the vfox plugin system
globals = {
"PLUGIN"
"PLUGIN",
}

-- Read-only globals from vfox environment
Expand Down Expand Up @@ -32,8 +32,9 @@ read_globals = {
-- Ignore line length warnings
max_line_length = false

-- Ignore unused arguments in hook functions
-- Ignore unused arguments in hook functions and unused globals
unused_args = false
unused = false

-- Allow trailing whitespace (can be auto-fixed)
-- Allow defined top-level variables and trailing whitespace
allow_defined_top = true
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ mise use -g semver@3.4.0
mise use semver@3.4.0
```

## Development

This project uses [hk](https://hk.jdx.dev) for pre-commit hooks and linting.

```bash
# Install pre-commit hooks
hk install

# Run linting manually
mise run lint

# Run all CI checks
mise run ci
```

## About semver

semver is a bash utility to manipulate and validate semantic versions. It provides commands to:
Expand Down
33 changes: 33 additions & 0 deletions hk.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
amends "package://github.com/jdx/hk/releases/download/v1.2.0/hk@1.2.0#/Config.pkl"
import "package://github.com/jdx/hk/releases/download/v1.2.0/hk@1.2.0#/Builtins.pkl"

local linters = new Mapping<String, Step> {
["luacheck"] {
glob = "**/*.lua"
check = "luarocks install luacheck --local || true && ~/.luarocks/bin/luacheck {{files}}"
}
["stylua"] {
glob = "**/*.lua"
check = "stylua --check {{files}}"
fix = "stylua {{files}}"
}
["actionlint"] {
glob = ".github/workflows/*.{yml,yaml}"
check = "actionlint {{files}}"
}
}

hooks {
["pre-commit"] {
fix = true
stash = "git"
steps = linters
}
["fix"] {
fix = true
steps = linters
}
["check"] {
steps = linters
}
}
2 changes: 1 addition & 1 deletion metadata.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- metadata.lua
PLUGIN = {
PLUGIN = { -- luacheck: ignore
name = "semver",
version = "1.0.0",
description = "A semantic versioning (semver) command-line tool",
Expand Down
7 changes: 0 additions & 7 deletions mise-tasks/lint

This file was deleted.

11 changes: 9 additions & 2 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
MISE_USE_VERSIONS_HOST = "0"

[tools]
actionlint = "1"
hk = "1"
lua = "5.4"
stylua = "latest"
pkl = "0.29"
stylua = "2"

[tasks.format]
description = "Format Lua scripts"
run = "stylua metadata.lua hooks/"

[tasks.lint]
description = "Lint Lua scripts and GitHub Actions using hk"
run = "hk check"

[tasks.ci]
description = "Run all CI checks"
depends = ["lint", "test"]
depends = ["lint", "test"]