-
Notifications
You must be signed in to change notification settings - Fork 0
25 Create cording rules #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # コーディングルール | ||
|
|
||
| ## 共通ルール | ||
|
|
||
| - ボーイスカウトルールに従う:コードを見つけたときよりも綺麗にする | ||
| - YAGNI(You Aren't Gonna Need It)の原則に従う:必要になるまで機能を実装しない | ||
| - DRY(Don't Repeat Yourself)の原則に従う:再利用可能なロジックを関数に抽出し、コードの重複を避ける | ||
| - KISS(Keep It Simple Stupid)の原則に従う:シンプルで分かりやすいコードを書く | ||
| - SOLIDの原則に従う | ||
| - タイポを検出し、修正を提案する | ||
|
|
||
| ## TypeScript/JavaScript | ||
|
|
||
| - インデントには2スペースを使用 | ||
| - Google JavaScript Style Guideに準拠 | ||
| - MDNにリストされている非推奨または廃止された機能の使用を避ける | ||
| - プロパティ名にはキャメルケースを使用し、必要に応じてPropTypesを適用 | ||
| - フックの使用に関する公式Reactガイドラインに従う | ||
| - インラインスタイルを避ける | ||
| - 'var'の代わりに'let'または'const'を使用 | ||
| - パフォーマンス最適化(メモ化、レンダリング最適化)を適切に実装 | ||
| - 不要な再レンダリングを防ぐために、関数コンポーネントにはReact.memo()を、クラスコンポーネントにはPureComponentを使用 | ||
| - コード分割と遅延ロードを実装 | ||
| - セキュリティ脆弱性(特にXSS)に注意 | ||
| - ユーザー入力をサニタイズし、dangerouslySetInnerHTMLの使用を避ける | ||
|
|
||
| ## Go | ||
|
|
||
| - インデントにはタブを使用(Go言語の標準的な方法) | ||
| - gofmtツールを使用してコードをフォーマット | ||
| - goimportsを使用してインポートを管理 | ||
| - go vetを使用して疑わしい構造を検出 | ||
| - golintを使用してスタイルエラーを検出 | ||
| - テストとベンチマークの実行 | ||
| - Go Style Guideに従う | ||
| - クリーンアーキテクチャの原則に従う | ||
| - DDD(Domain-Driven Design)の原則を適用 | ||
|
|
||
| ## React (TSX) | ||
|
|
||
| - セマンティックなHTML要素を使用 | ||
| - Reactのベストプラクティスに従う | ||
| - WAI-ARIA属性を実装 | ||
| - 適切なキーボードナビゲーションサポート | ||
| - 可視テキストのない要素にはaria-labelまたはaria-labelledbyを使用 | ||
| - モーダルやその他の動的コンテンツにフォーカス管理を実装 | ||
|
|
||
| ## テスト | ||
|
|
||
| - テストフレームワークのベストプラクティスに従う | ||
| - テストの説明を詳細に記述 | ||
| - 適切なアサーションとマッチャーを使用 | ||
| - 重要なパスとエッジケースのテストカバレッジを実装 | ||
| - テストを独立させ、テスト間で状態を共有しない | ||
|
|
||
| ## Docker | ||
|
|
||
| - Dockerfile Best Practicesに従う | ||
| - マルチステージビルドを活用 | ||
| - 適切なベースイメージを選択 | ||
| - ビルドキャッシュを効果的に利用 | ||
| - 最小権限の原則に従う | ||
| - .dockerignoreファイルを使用 | ||
| - RUN命令を結合 | ||
| - 適切な環境変数の設定 | ||
| - 必要最小限のファイルのみをコピー | ||
| - ヘルスチェックの実装 | ||
| - Linterツールの使用を検討 | ||
|
|
||
| ## Markdown | ||
|
|
||
| - [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2)に準拠していること | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // TODO:機能している? | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JSONにコメントは許可されていません。 🧰 Tools🪛 Biome (1.9.4)[error] 1-3: Expected an array, an object, or a literal but instead found '// TODO:機能している?'. Expected an array, an object, or a literal here. (parse) 🤖 Prompt for AI Agents |
||
| { | ||
| "cursor.review": { | ||
| "enabled": true, | ||
| "autoReview": true | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,5 +2,3 @@ | |
|
|
||
| # テストカバレッジレポート | ||
| */coverage.out | ||
|
|
||
| node_modules/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,9 @@ | ||
| # README | ||
|
|
||
| ## Setup | ||
|
|
||
| [Setup procedure](./docs/develop/setup/index.md) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainリンク先ファイルの存在を確認してください。 🏁 Script executed: #!/bin/bash
# 新規READMEリンク先ファイルの有無チェック
if [ ! -f docs/develop/setup/index.md ]; then
echo "docs/develop/setup/index.md not found"
exit 1
fiLength of output: 138 リンク切れ検出: docs/develop/setup/index.md が存在しません
🤖 Prompt for AI Agents |
||
|
|
||
| ## Other | ||
|
|
||
|  | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,6 +9,7 @@ const App: React.FC = () => { | |||||||||
| const checkHealth = async (retries = 5) => { | ||||||||||
| for (let i = 0; i < retries; i++) { | ||||||||||
| try { | ||||||||||
| // FIXME:URLのハードコードを避ける | ||||||||||
| const response = await fetch("http://localhost:8080/health"); | ||||||||||
|
Comment on lines
+12
to
13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion エンドポイントURLを環境変数に切り出してください。 - // FIXME:URLのハードコードを避ける
- const response = await fetch("http://localhost:8080/health");
+ const healthUrl = import.meta.env.VITE_HEALTH_URL || "http://localhost:8080/health";
+ const response = await fetch(healthUrl);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| if (response.ok) { | ||||||||||
| const data = await response.json(); | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Lintツールの統一性を確認してください
golintは非推奨となっており、現在はstaticcheckやgolangci-lintの使用が推奨されています。ツールの推奨事項を最新のものに更新することを検討してください。最新のGo lintingツールの推奨事項を確認するために、以下の情報を検索してください:
🌐 Web query:
💡 Result:
Go言語の静的解析ツールとして、
golintはメンテナンスが行われておらず、非推奨となっています。代替として、以下のツールが推奨されています。1. staticcheck
staticcheckは、Goコードの静的解析を行うツールで、バグの検出やコードの簡素化、未使用コードの検出など、多岐にわたるチェックを提供します。GoチームやGoogleがスポンサーとなっており、信頼性の高いツールです。特定のチェック項目を無効にするなどの設定も可能で、ソースコード内に//lint:ignore Check1[,Check2,...,CheckN] reasonとコメントすることで、特定の警告を無効にできます。 (zenn.dev)2. revive
reviveは、golintの代替として開発されたツールで、より高速で厳格、かつ拡張性の高い静的解析を提供します。設定可能なルールセットやカスタムルールの追加が可能で、柔軟なコードスタイルのチェックが行えます。 (best-of-web.builder.io)3. golangci-lint
golangci-lintは、複数の静的解析ツールを統合したラッパーで、staticcheckやreviveなど、さまざまなツールを一元的に管理・実行できます。これにより、複数のツールを個別に設定・実行する手間を省き、効率的なコード品質の維持が可能となります。 (golangci-lint.run)これらのツールは、Go言語のコード品質向上に役立つ強力なツールです。プロジェクトのニーズやチームの方針に合わせて、適切なツールを選択・導入することをおすすめします。
Citations:
Lintツールの推奨を
golintからstaticcheck/golangci-lintに更新してください.cursor/rules/coding_rules.mdgolintは非推奨となっているため、以下のいずれかを検討してください:または
プロジェクトの要件に合わせてツールを選択し、設定手順や実行コマンドをドキュメントに追記してください。
📝 Committable suggestion
🤖 Prompt for AI Agents