Skip to content

left-hook導入 (#107)#166

Merged
KOU050223 merged 1 commit intomainfrom
vk/b05b-left-hook-107
Jan 28, 2026
Merged

left-hook導入 (#107)#166
KOU050223 merged 1 commit intomainfrom
vk/b05b-left-hook-107

Conversation

@KOU050223
Copy link
Owner

@KOU050223 KOU050223 commented Jan 28, 2026

GitHub issue #107: https://zenn.dev/10_tofu_01/articles/flutter_formatter_linter_lefthook
せめてformatterだけでもしておくと楽そう
ラベル: 子issue

Summary by CodeRabbit

  • Chores
    • Added pre-commit hooks configuration for automatic Dart code formatting and static analysis on commits.

✏️ Tip: You can customize this high-level summary in your review settings.

## 実装内容

以下の作業を完了しました:

### 1. **lefthook.yml の作成** (lefthook.yml)
Zennの記事を参考に、以下の機能を持つ設定ファイルを作成しました:

- **pre-commitフック**: コミット前に自動実行
- **format コマンド**: `dart format`でコードを自動フォーマットし、変更をステージに追加
- **analyze コマンド**: `flutter analyze`で静的解析を実行
- **parallel: false**: 順序を保証するため、並列実行を無効化

### 2. **lefthookのインストール**
- `lefthook install` を実行し、Gitフックに登録完了
- pre-commitフックが正常に設定されました

### 3. **動作確認**
- 静的解析が正常に動作することを確認
- 既存のanalysis_options.yamlの設定と互換性があることを確認

## 使用方法

今後、Dartファイルをコミットする際:
1. `git add` でファイルをステージング
2. `git commit` を実行
3. 自動的に以下が実行されます:
   - コードフォーマット (dart format)
   - 静的解析 (flutter analyze)
4. エラーがなければコミットが完了

手動でフックを実行したい場合:
```bash
lefthook run pre-commit
```

これで、コミット時に自動的にコードの品質が保証されるようになりました!
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a Lefthook configuration file for Dart project pre-commit hooks. Configures parallel execution to false and defines two commands: one to format staged Dart files using dart format with re-staging enabled, and another to run static analysis via flutter analyze on all Dart files.

Changes

Cohort / File(s) Summary
Pre-commit Hook Configuration
lefthook.yml
Introduces Lefthook configuration with disabled parallel execution and two pre-commit commands: format (runs dart format and re-stages files) and analyze (runs flutter analyze on Dart files)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hoppy hooks now guard the gate,
Dart files formatted, looking great!
Flutter checks will analyze with care,
Pre-commit magic in the air!


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@KOU050223 KOU050223 changed the title left-hook導入 (#107) (vibe-kanban) left-hook導入 (#107) Jan 28, 2026
@github-actions
Copy link

Visit the preview URL for this PR (updated for commit f5138a8):

https://animeishi-73560--pr166-vk-b05b-left-hook-10-ic29kdr1.web.app

(expires Wed, 04 Feb 2026 14:20:41 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f1f494a67df8ccbb2232f73b6ccab4934a51e505

@KOU050223 KOU050223 merged commit 321044f into main Jan 28, 2026
4 of 5 checks passed
@KOU050223 KOU050223 deleted the vk/b05b-left-hook-107 branch January 28, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant