Skip to content

Commit 28bf7d7

Browse files
committed
refactor
1 parent fce4012 commit 28bf7d7

File tree

15 files changed

+1944
-102
lines changed

15 files changed

+1944
-102
lines changed

.github/workflows/frontend-ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,23 @@ jobs:
8080

8181
- name: Run type check
8282
run: npx tsc --noEmit
83+
84+
test:
85+
name: Vitest
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- name: Checkout code
90+
uses: actions/checkout@v4
91+
92+
- name: Setup Node.js
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: '20'
96+
cache: 'npm'
97+
98+
- name: Install dependencies
99+
run: npm ci
100+
101+
- name: Run tests
102+
run: npm run test

.github/workflows/rust-ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,96 @@ jobs:
104104
run: cargo fmt -- --check
105105
working-directory: ./src-tauri
106106

107+
coverage:
108+
name: Coverage
109+
runs-on: ubuntu-latest
110+
111+
steps:
112+
- name: Checkout code
113+
uses: actions/checkout@v4
114+
115+
- name: Install Linux dependencies
116+
run: |
117+
sudo apt-get update
118+
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libudev-dev
119+
120+
- name: Setup Rust toolchain
121+
uses: dtolnay/rust-toolchain@stable
122+
with:
123+
components: llvm-tools-preview
124+
125+
- name: Install cargo-llvm-cov
126+
uses: taiki-e/install-action@cargo-llvm-cov
127+
128+
- name: Run tests with coverage
129+
run: cargo llvm-cov --lib --no-fail-fast
130+
working-directory: ./src-tauri
131+
132+
unused-deps:
133+
name: Unused Dependencies
134+
runs-on: ubuntu-latest
135+
136+
steps:
137+
- name: Checkout code
138+
uses: actions/checkout@v4
139+
140+
- name: Install Linux dependencies
141+
run: |
142+
sudo apt-get update
143+
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libudev-dev
144+
145+
- name: Setup Rust toolchain
146+
uses: dtolnay/rust-toolchain@stable
147+
148+
- name: Install cargo-machete
149+
run: cargo install cargo-machete
150+
151+
- name: Check for unused dependencies
152+
run: cargo machete
153+
working-directory: ./src-tauri
154+
155+
security-audit:
156+
name: Security Audit
157+
runs-on: ubuntu-latest
158+
159+
steps:
160+
- name: Checkout code
161+
uses: actions/checkout@v4
162+
163+
- name: Setup Rust toolchain
164+
uses: dtolnay/rust-toolchain@stable
165+
166+
- name: Install cargo-audit
167+
run: cargo install cargo-audit
168+
169+
- name: Run security audit
170+
run: cargo audit
171+
working-directory: ./src-tauri
172+
173+
outdated-deps:
174+
name: Outdated Dependencies
175+
runs-on: ubuntu-latest
176+
continue-on-error: true # Don't fail CI, just report
177+
178+
steps:
179+
- name: Checkout code
180+
uses: actions/checkout@v4
181+
182+
- name: Install Linux dependencies
183+
run: |
184+
sudo apt-get update
185+
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libudev-dev
186+
187+
- name: Setup Rust toolchain
188+
uses: dtolnay/rust-toolchain@stable
189+
190+
- name: Install cargo-outdated
191+
run: cargo install cargo-outdated
192+
193+
- name: Check for outdated dependencies
194+
run: cargo outdated --exit-code 1 || true
195+
working-directory: ./src-tauri
196+
107197
build:
108198
name: Build (${{ matrix.os }})
109199
runs-on: ${{ matrix.os }}

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,47 @@ npm run tauri dev
3939
npm run tauri build
4040
```
4141

42+
## コード品質チェック
43+
44+
### Frontend (TypeScript)
45+
46+
```bash
47+
# 型チェック
48+
npm run type-check
49+
50+
# Lint
51+
npm run lint
52+
53+
# フォーマットチェック
54+
npm run format:check
55+
56+
# フォーマット適用
57+
npm run format
58+
```
59+
60+
### Backend (Rust)
61+
62+
```bash
63+
cd src-tauri
64+
65+
# テスト
66+
cargo test --lib
67+
68+
# Lint (Clippy)
69+
cargo clippy --lib -- -D warnings
70+
71+
# フォーマットチェック
72+
cargo fmt -- --check
73+
74+
# フォーマット適用
75+
cargo fmt
76+
77+
# カバレッジ(要 cargo-llvm-cov)
78+
cargo install cargo-llvm-cov # 初回のみ
79+
cargo llvm-cov --lib
80+
cargo llvm-cov --lib --html --open # HTMLレポート
81+
```
82+
4283
## 実装状況
4384

4485
-**Phase 1**: Win32 API基盤構築と基本通信機能

agents/prompts.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ cargo clippy
1515
cd src-tauri
1616
cargo fmt
1717

18-
cd viewer/
19-
npm run test:coverage
18+
cd src-tauri
19+
cargo llvm-cov --lib
2020
カバレッジレポートを見て,カバレッジが100%に近くテストの追加が簡単そうなところからテストを追加してください.または,意図的なdeadcodeであればそれをeslint-disableなどで明記してください.
2121

2222
eslint-disableの使用は適切ですか?本当にeslint-disableをするのが避けられないのか,本質的に不適切なコードなのか全て調べてください.
2323

24+
clippyの警告を発生させないようにallowなどをしている箇所がありますが,これは適切ですか?本当に避けられないのか,本質的に不適切なコードなのか,今後実装が必要なのか全て調べてください.
25+
2426
現状ほぼ全てのテストに通っていますが,プロダクトのコードもテストコードも両方間違っている可能性も存在します.テストコードをレビューして,問題がなさそうか確認してください.問題がなくても,単体テストの設計が不適切であればリファクタリング方針を示してください.
2527

2628
ドキュメントを整理してください.

0 commit comments

Comments
 (0)