diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c0090a3..5a47fbb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,15 +11,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Configure Git - run: | - git config --global user.email "jdoe@example.com" - git config --global user.name "J. Doe" - - name: Run install-dev-tools.sh + - name: Install mise run: | set -e - mkdir $HOME/bin - ./dev/bin/install-dev-tools.sh + set -x + curl https://mise.run | sh + mise install - name: Run precious run: | - PATH=$PATH:$HOME/bin precious lint -a + mise exec -- precious lint -a diff --git a/dev/bin/install-dev-tools.sh b/dev/bin/install-dev-tools.sh deleted file mode 100755 index 9234136..0000000 --- a/dev/bin/install-dev-tools.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/bash - -set -eo pipefail -set -x - -function run() { - echo "$1" - eval "$1" -} - -function install_tools() { - curl --silent --location \ - https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh | - sh - run "ubi --project houseabsolute/precious --in $HOME/bin" - run "ubi --project houseabsolute/omegasort --in $HOME/bin" - run "ubi --project koalaman/shellcheck --in $HOME/bin" - run "ubi --project mvdan/sh --in $HOME/bin --exe shfmt" - run "ubi --project crate-ci/typos --in $HOME/bin" - run "npm install prettier" - run "curl -L https://cpanmin.us/ -o $HOME/bin/cpanm" - run "chmod 0755 $HOME/bin/cpanm" - run "$HOME/bin/cpanm --sudo --notest Perl::Tidy" -} - -if [ "$1" == "-v" ]; then - set -x -fi - -mkdir -p "$HOME"/bin - -set +e -echo ":$PATH:" | grep --extended-regexp ":$HOME/bin:" >&/dev/null -# shellcheck disable=SC2181 -if [ "$?" -eq "0" ]; then - path_has_home_bin=1 -fi -set -e - -if [ -z "$path_has_home_bin" ]; then - PATH=$HOME/bin:$PATH -fi - -install_tools - -echo "Tools were installed into $HOME/bin." -if [ -z "$path_has_home_bin" ]; then - echo "You should add $HOME/bin to your PATH." -fi - -exit 0 diff --git a/mise.toml b/mise.toml new file mode 100644 index 0000000..2b5bb4e --- /dev/null +++ b/mise.toml @@ -0,0 +1,10 @@ +[tools] +node = "22.11.0" +"npm:prettier" = "3.4.1" +ruff = "0.8.3" +shellcheck = "v0.10.0" +shfmt = "v3.10.0" +taplo = "0.9.3" +typos = "1.28.1" +"ubi:houseabsolute/omegasort" = "v0.1.3" +"ubi:houseabsolute/precious" = "v0.7.3" diff --git a/precious.toml b/precious.toml index c6ef685..ac07b63 100644 --- a/precious.toml +++ b/precious.toml @@ -24,10 +24,28 @@ ok_exit_codes = 0 lint_failure_exit_codes = 2 ignore_stderr = "Begin Error Output Stream" +[commands."ruff for linting"] +type = "both" +include = [ "**/*.py" ] +cmd = "ruff" +lint_flags = [ "check" ] +tidy_flags = [ "check", "--fix" ] +ok_exit_codes = 0 +lint_failure_exit_codes = 1 + +[commands."ruff for tidying"] +type = "both" +include = [ "**/*.py" ] +cmd = "ruff" +lint_flags = [ "format", "--check" ] +tidy_flags = [ "format" ] +ok_exit_codes = 0 +lint_failure_exit_codes = 1 + [commands.prettier-md] type = "both" include = [ "**/*.md" ] -cmd = [ "./node_modules/.bin/prettier", "--no-config", "--print-width", "100", "--prose-wrap", "always" ] +cmd = [ "prettier", "--no-config", "--print-width", "100", "--prose-wrap", "always" ] lint_flags = "--check" tidy_flags = "--write" ok_exit_codes = 0 @@ -37,7 +55,7 @@ ignore_stderr = [ "Code style issues" ] [commands.prettier-yml] type = "both" include = [ "**/*.yml" ] -cmd = [ "./node_modules/.bin/prettier", "--no-config" ] +cmd = [ "prettier", "--no-config" ] lint_flags = "--check" tidy_flags = "--write" ok_exit_codes = 0