From 1f7c71f5c975721120a31b729b214171eb2966f3 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Thu, 19 Mar 2026 17:08:47 -0700 Subject: [PATCH] Use released DotSlash package for argument-comment lint --- .github/workflows/rust-ci.yml | 6 +- justfile | 7 +- tools/argument-comment-lint/README.md | 32 +++++ .../argument-comment-lint | 79 +++++++++++ .../argument-comment-lint/run-from-source.sh | 123 ++++++++++++++++++ tools/argument-comment-lint/run.sh | 40 +----- 6 files changed, 252 insertions(+), 35 deletions(-) create mode 100755 tools/argument-comment-lint/argument-comment-lint create mode 100755 tools/argument-comment-lint/run-from-source.sh diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml index 287e7e540f..634e744ac2 100644 --- a/.github/workflows/rust-ci.yml +++ b/.github/workflows/rust-ci.yml @@ -103,11 +103,13 @@ jobs: sudo DEBIAN_FRONTEND=noninteractive apt-get update sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends pkg-config libcap-dev - uses: dtolnay/rust-toolchain@1.93.0 + if: ${{ needs.changed.outputs.argument_comment_lint_package == 'true' || github.event_name == 'push' }} with: toolchain: nightly-2025-09-18 components: llvm-tools-preview, rustc-dev, rust-src - name: Cache cargo-dylint tooling id: cargo_dylint_cache + if: ${{ needs.changed.outputs.argument_comment_lint_package == 'true' || github.event_name == 'push' }} uses: actions/cache@v5 with: path: | @@ -118,8 +120,9 @@ jobs: ~/.cargo/git/db key: argument-comment-lint-${{ runner.os }}-${{ hashFiles('tools/argument-comment-lint/Cargo.lock', 'tools/argument-comment-lint/rust-toolchain', '.github/workflows/rust-ci.yml') }} - name: Install cargo-dylint tooling - if: ${{ steps.cargo_dylint_cache.outputs.cache-hit != 'true' }} + if: ${{ (needs.changed.outputs.argument_comment_lint_package == 'true' || github.event_name == 'push') && steps.cargo_dylint_cache.outputs.cache-hit != 'true' }} run: cargo install --locked cargo-dylint dylint-link + - uses: facebook/install-dotslash@v2 - name: Test argument comment lint package if: ${{ needs.changed.outputs.argument_comment_lint_package == 'true' || github.event_name == 'push' }} working-directory: tools/argument-comment-lint @@ -127,6 +130,7 @@ jobs: - name: Run argument comment lint on codex-rs run: | bash -n tools/argument-comment-lint/run.sh + bash -n tools/argument-comment-lint/run-from-source.sh ./tools/argument-comment-lint/run.sh # --- CI to validate on different os/targets -------------------------------- diff --git a/justfile b/justfile index e32a96181e..1aa8c33554 100644 --- a/justfile +++ b/justfile @@ -30,8 +30,9 @@ fmt: fix *args: cargo clippy --fix --tests --allow-dirty "$@" -clippy: +clippy *args: cargo clippy --tests "$@" + ../tools/argument-comment-lint/run.sh "$@" install: rustup show active-toolchain @@ -91,6 +92,10 @@ write-hooks-schema: argument-comment-lint *args: ./tools/argument-comment-lint/run.sh "$@" +[no-cd] +argument-comment-lint-from-source *args: + ./tools/argument-comment-lint/run-from-source.sh "$@" + # Tail logs from the state SQLite database log *args: if [ "${1:-}" = "--" ]; then shift; fi; cargo run -p codex-state --bin logs_client -- "$@" diff --git a/tools/argument-comment-lint/README.md b/tools/argument-comment-lint/README.md index 91c1fdecc8..bc41b35aa7 100644 --- a/tools/argument-comment-lint/README.md +++ b/tools/argument-comment-lint/README.md @@ -73,6 +73,38 @@ GitHub releases also publish a DotSlash file named x64. The published package contains a small runner executable, a bundled `cargo-dylint`, and the prebuilt lint library. +The checked-in DotSlash file lives at `tools/argument-comment-lint/argument-comment-lint`. +`run.sh` resolves that file via `dotslash` and is the path used by +`just clippy`, `just argument-comment-lint`, and the Rust CI job. The +source-build path remains available in `run-from-source.sh` for people +iterating on the lint crate itself. + +The Unix archive layout is: + +```text +argument-comment-lint/ + bin/ + argument-comment-lint + cargo-dylint + lib/ + libargument_comment_lint@nightly-2025-09-18-.dylib|so +``` + +On Windows the same layout is published as a `.zip`, with `.exe` and `.dll` +filenames instead. + +DotSlash resolves the package entrypoint to `argument-comment-lint/bin/argument-comment-lint` +(or `.exe` on Windows). That runner then finds the sibling bundled +`cargo-dylint` binary and the single packaged Dylint library under `lib/`, and +invokes `cargo-dylint dylint --lib-path ` with the repo's default +`DYLINT_RUSTFLAGS` and `CARGO_INCREMENTAL=0` settings. + +If you are changing the lint crate itself, use the source-build wrapper: + +```bash +./tools/argument-comment-lint/run-from-source.sh -p codex-core +``` + Run the lint against `codex-rs` from the repo root: ```bash diff --git a/tools/argument-comment-lint/argument-comment-lint b/tools/argument-comment-lint/argument-comment-lint new file mode 100755 index 0000000000..602117e3ce --- /dev/null +++ b/tools/argument-comment-lint/argument-comment-lint @@ -0,0 +1,79 @@ +#!/usr/bin/env dotslash + +{ + "name": "argument-comment-lint", + "platforms": { + "macos-aarch64": { + "size": 3402747, + "hash": "blake3", + "digest": "a11669d2f184a2c6f226cedce1bf10d1ec478d53413c42fe80d17dd873fdb2d7", + "format": "tar.gz", + "path": "argument-comment-lint/bin/argument-comment-lint", + "providers": [ + { + "url": "https://github.com/openai/codex/releases/download/rust-v0.117.0-alpha.2/argument-comment-lint-aarch64-apple-darwin.tar.gz" + }, + { + "type": "github-release", + "repo": "https://github.com/openai/codex", + "tag": "rust-v0.117.0-alpha.2", + "name": "argument-comment-lint-aarch64-apple-darwin.tar.gz" + } + ] + }, + "linux-x86_64": { + "size": 3869711, + "hash": "blake3", + "digest": "1015f4ba07d57edc5ec79c8f6709ddc1516f64c903e909820437a4b89d8d853a", + "format": "tar.gz", + "path": "argument-comment-lint/bin/argument-comment-lint", + "providers": [ + { + "url": "https://github.com/openai/codex/releases/download/rust-v0.117.0-alpha.2/argument-comment-lint-x86_64-unknown-linux-gnu.tar.gz" + }, + { + "type": "github-release", + "repo": "https://github.com/openai/codex", + "tag": "rust-v0.117.0-alpha.2", + "name": "argument-comment-lint-x86_64-unknown-linux-gnu.tar.gz" + } + ] + }, + "linux-aarch64": { + "size": 3759446, + "hash": "blake3", + "digest": "91f2a31e6390ca728ad09ae1aa6b6f379c67d996efcc22956001df89f068af5b", + "format": "tar.gz", + "path": "argument-comment-lint/bin/argument-comment-lint", + "providers": [ + { + "url": "https://github.com/openai/codex/releases/download/rust-v0.117.0-alpha.2/argument-comment-lint-aarch64-unknown-linux-gnu.tar.gz" + }, + { + "type": "github-release", + "repo": "https://github.com/openai/codex", + "tag": "rust-v0.117.0-alpha.2", + "name": "argument-comment-lint-aarch64-unknown-linux-gnu.tar.gz" + } + ] + }, + "windows-x86_64": { + "size": 3244599, + "hash": "blake3", + "digest": "dc711c6d85b1cabbe52447dda3872deb20c2e64b155da8be0ecb207c7c391683", + "format": "zip", + "path": "argument-comment-lint/bin/argument-comment-lint.exe", + "providers": [ + { + "url": "https://github.com/openai/codex/releases/download/rust-v0.117.0-alpha.2/argument-comment-lint-x86_64-pc-windows-msvc.zip" + }, + { + "type": "github-release", + "repo": "https://github.com/openai/codex", + "tag": "rust-v0.117.0-alpha.2", + "name": "argument-comment-lint-x86_64-pc-windows-msvc.zip" + } + ] + } + } +} diff --git a/tools/argument-comment-lint/run-from-source.sh b/tools/argument-comment-lint/run-from-source.sh new file mode 100755 index 0000000000..26cc3c73f0 --- /dev/null +++ b/tools/argument-comment-lint/run-from-source.sh @@ -0,0 +1,123 @@ +#!/usr/bin/env bash + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +lint_path="$repo_root/tools/argument-comment-lint" +manifest_path="$repo_root/codex-rs/Cargo.toml" +toolchain_channel="nightly-2025-09-18" +strict_lint="uncommented-anonymous-literal-argument" +noise_lint="unknown_lints" + +has_manifest_path=false +has_package_selection=false +has_no_deps=false +has_library_selection=false +expect_value="" + +ensure_local_prerequisites() { + if ! command -v cargo-dylint >/dev/null 2>&1 || ! command -v dylint-link >/dev/null 2>&1; then + cat >&2 <&2 <