8000 Make the CI documents give the commands the quality check script runs by dominion525 · Pull Request #160 · dominion525/jetdb · GitHub
[go: up one dir, main page]

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
10 changes: 5 additions & 5 deletions docs/ci.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cargo test -p jetdb-cli # CLI のみ
Rust の静的解析ツール。警告をエラーとして扱い、コードの品質を保つ。

```bash
cargo clippy -- -D warnings
cargo clippy --all-targets -- -D warnings
```

インストール(rustup に含まれていない場合):
Expand Down Expand Up @@ -62,7 +62,7 @@ rustup target add wasm32-unknown-unknown wasm32-wasip1
cargo install wasm-bindgen-cli --version <version> --locked
```

`wasm-bindgen-test-runner` と `wasm-bindgen`(どちらも `wasm-bindgen-cli` に含まれる)は、`Cargo.lock` の `wasm-bindgen` と同じ版である必要がある。版が違うと `scripts/build-wasm-package.sh` は止まる。版は次で確認できる:
`wasm-bindgen-test-runner` と `wasm-bindgen`(どちらも `wasm-bindgen-cli` に含まれる)は、`Cargo.lock` の `wasm-bindgen` と同じ版である必要がある。`wasm-bindgen` の版が違うと `scripts/build-wasm-package.sh` は止まる。版は次で確認できる:

```bash
cargo metadata --format-version 1 --filter-platform wasm32-unknown-unknown | jq -r '.packages[] | select(.name == "wasm-bindgen") | .version'
Expand Down Expand Up @@ -107,10 +107,10 @@ RUSTDOCFLAGS="-D warnings" cargo doc --workspace
ソースコードの循環的複雑度・認知的複雑度などのメトリクスを計測する。

```bash
rust-code-analysis-cli -m -p crates/ -O json
rust-code-analysis-cli -m -p crates/ -X '**/node_modules/**' 'crates/jetdb-wasm/pkg/**' -O json
```

JSON 出力は `complexity-filter` クレート(`crates/complexity-filter/`)を通して、閾値(CC>=10、Cognitive>=10、SLOC>=50)を超える関数のみを表示する。`quality-check.sh` スクリプトが自動的にこの処理を行う。
JSON 出力は `complexity-filter` クレート(`crates/complexity-filter/`)を通して、閾値(CC>=10、Cognitive>=10、SLOC>=50)を超える関数のみを表示する。`quality-check.sh` スクリプトが自動的にこの処理を行う。`-X` のパターンで、第三者のコードと生成されたコード、つまりブラウザ用テストのために入れた npm パッケージ(`node_modules`)と wasm-bindgen が生成した `jetdb-wasm` パッケージ(`crates/jetdb-wasm/pkg/`)を対象から外す。

インストール:

Expand Down Expand Up @@ -169,7 +169,7 @@ scripts/quality-check.sh
品質チェックスクリプトは以下の順序でチェックを実行する:

1. `cargo test` — まず既存テストが通ることを確認
2. `cargo clippy -- -D warnings` — コード品質のチェック
2. `cargo clippy --all-targets -- -D warnings` — コード品質のチェック
3. Wasm — WASI でライブラリのテストを、Node.js 上でブラウザ用テストを実行し、npm パッケージをビルドしてテスト
4. `cargo audit` — セキュリティ上の問題がないか確認
5. `cargo doc --workspace` — ドキュメントが警告なしで正しく生成されるか確認
Expand Down
10 changes: 5 additions & 5 deletions docs/ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Some test data is not stored in the repository. Run `scripts/fetch-testdata.sh`
Rust static analysis tool. Treats warnings as errors to maintain code quality.

```bash
cargo clippy -- -D warnings
cargo clippy --all-targets -- -D warnings
```

Installation (if not already included with rustup):
Expand Down Expand Up @@ -62,7 +62,7 @@ rustup target add wasm32-unknown-unknown wasm32-wasip1
cargo install wasm-bindgen-cli --version <version> --locked
```

`wasm-bindgen-test-runner` and `wasm-bindgen` (both installed by `wasm-bindgen-cli`) must be the same version as `wasm-bindgen` in `Cargo.lock`; `scripts/build-wasm-package.sh` stops if they differ. Find that version with:
`wasm-bindgen-test-runner` and `wasm-bindgen` (both installed by `wasm-bindgen-cli`) must be the same version as `wasm-bindgen` in `Cargo.lock`; `scripts/build-wasm-package.sh` stops if `wasm-bindgen` differs. Find that version with:

```bash
cargo metadata --format-version 1 --filter-platform wasm32-unknown-unknown | jq -r '.packages[] | select(.name == "wasm-bindgen") | .version'
Expand Down Expand Up @@ -107,10 +107,10 @@ Generated documentation is output to `target/doc/jetdb/index.html`.
Measure cyclomatic complexity, cognitive complexity, and other source code metrics.

```bash
rust-code-analysis-cli -m -p crates/ -O json
rust-code-analysis-cli -m -p crates/ -X '**/node_modules/**' 'crates/jetdb-wasm/pkg/**' -O json
```

The raw JSON output is piped through the `complexity-filter` crate (`crates/complexity-filter/`) to display only functions exceeding the threshold (CC>=10, Cognitive>=10, or SLOC>=50). The `quality-check.sh` script runs this automatically.
The raw JSON output is piped through the `complexity-filter` crate (`crates/complexity-filter/`) to display only functions exceeding the threshold (CC>=10, Cognitive>=10, or SLOC>=50). The `quality-check.sh` script runs this automatically. The `-X` patterns leave out third-party and generated code: the npm packages installed for the browser tests (`node_modules`) and the `jetdb-wasm` package generated by wasm-bindgen (`crates/jetdb-wasm/pkg/`).

Installation:

Expand Down Expand Up @@ -169,7 +169,7 @@ The script stops immediately on test or clippy failure. Other checks (wasm, audi
The quality check script runs checks in the following order:

1. `cargo test` — Verify existing tests pass first
2. `cargo clippy -- -D warnings` — Check code quality
2. `cargo clippy --all-targets -- -D warnings` — Check code quality
3. Wasm — Run the library tests on WASI and the browser tests on Node.js, and build and test the npm package
4. `cargo audit` — Check for security issues
5. `cargo doc --workspace` — Verify documentation builds correctly, without warnings
Expand Down
Loading
0