Skip to repository content65 lines · 2.0 KB · text
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T03:31:17.130Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
single-lint
1#!/usr/bin/env bash
2#
3# Run a single lint from this dylint library against the Zed workspace.
4#
5# Usage: tooling/lints/single-lint <lint_name> [cargo check args...]
6# Example: tooling/lints/single-lint blocking_io_on_foreground -p project_panel
7#
8# Dylint loads the whole library, so we silence every lint with `-A warnings`
9# and force just the requested one back on with `--force-warn`. A plain
10# `-W <lint>` is dropped for a driver-registered lint once the group is allowed,
11# which is why `--force-warn` is required.
12#
13# `DYLINT_RUSTFLAGS` is not part of Cargo's fingerprint, so changing it does not
14# invalidate already-checked crates. We therefore clean the targeted package(s)
15# first so the filter actually applies instead of replaying a stale cache. When
16# no package is named (a `--workspace` run) we drop the whole check cache.
17set -euo pipefail
18
19if [ "$#" -lt 1 ]; then
20 echo "usage: $(basename "$0") <lint_name> [cargo check args...]" >&2
21 exit 1
22fi
23
24lint="$1"
25shift
26if [ "$#" -eq 0 ]; then
27 set -- --workspace
28fi
29
30script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
31repo_root="$(cd "$script_dir/../.." && pwd)"
32
33toolchain="$(awk -F'"' '/^channel/ {print $2}' "$script_dir/rust-toolchain.toml")"
34host="$(rustc -vV | awk '/^host:/ {print $2}')"
35check_target="$repo_root/target/dylint/target/${toolchain}-${host}"
36
37# Force a re-check of the requested package(s) so the lint filter takes effect.
38cleaned_any=0
39prev=""
40for arg in "$@"; do
41 pkg=""
42 case "$arg" in
43 -p=* | --package=*)
44 pkg="${arg#*=}"
45 ;;
46 *)
47 if [ "$prev" = "-p" ] || [ "$prev" = "--package" ]; then
48 pkg="$arg"
49 fi
50 ;;
51 esac
52 if [ -n "$pkg" ]; then
53 cargo clean -p "$pkg" --target-dir "$check_target" 2>/dev/null || true
54 cleaned_any=1
55 fi
56 prev="$arg"
57done
58
59if [ "$cleaned_any" -eq 0 ]; then
60 rm -rf "$check_target"
61fi
62
63cd "$repo_root"
64DYLINT_RUSTFLAGS="-A warnings --force-warn $lint" exec cargo dylint --all -- "$@"
65