From 1c9108610d3ba4a7be98ef282d45707f458df3fe Mon Sep 17 00:00:00 2001 From: oxalica Date: Sun, 13 Oct 2024 04:30:53 -0400 Subject: [PATCH] ci,contrib: add typos and pre-commit script --- .github/workflows/ci.yaml | 3 +++ .typos.toml | 0 blahd/src/id.rs | 2 +- contrib/pre-commit | 5 +++++ 4 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .typos.toml create mode 100755 contrib/pre-commit diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e2378bc..59cc7f7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,6 +37,9 @@ jobs: - name: Rustdoc run: cargo doc --workspace --no-deps + - name: Typos + uses: crate-ci/typos@v1.26.0 + test: strategy: fail-fast: false diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000..e69de29 diff --git a/blahd/src/id.rs b/blahd/src/id.rs index 0c3bb20..9e618bf 100644 --- a/blahd/src/id.rs +++ b/blahd/src/id.rs @@ -38,7 +38,7 @@ impl IdExt for Id { last_id.set(id); Id(id) } else { - // Otherwise, try to increse the trailing counter. + // Otherwise, try to increase the trailing counter. assert!(prev < (1 << 16), "id counter overflow"); last_id.set(prev + 1); Id(prev + 1) diff --git a/contrib/pre-commit b/contrib/pre-commit new file mode 100755 index 0000000..da74696 --- /dev/null +++ b/contrib/pre-commit @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail +typos +cargo fmt -- --check +fd -e nix | xargs nixfmt --check