Liferayのソースコードを対象に、対応する整形ツールとルールを使って形式をそろえ、生成ファイルを避けながら修正対象を確認できます。
- モジュールのソースを整形したいとき
- コミット済み変更の書式を確認したいとき
- Goやシェルの整形ルールを適用したいとき
Gitコミットやレビューコメントから、他のコードにも適用できる規約を見つけ、重複を確認したうえでレビュー用ルールとして追加・検証します。
Add a new rule to pr-reviewer/rules, derived from a Git commit or a review comment.
実行スコア 未検証
インストール方法を見るGitコミットの差分、またはプルリクエストのレビューコメントと指摘対象のコードを調べ、今後のレビューでも機械的に判定できる規約を1つ特定します。既存ルールや STYLE.md と照らして重複を確認し、該当カテゴリの連番で pr-reviewer/rules にルールを追加します。内容は規約、理由、違反とみなす範囲、コミットやプルリクエストをもとにした例で構成します。必要なら review.sh のグループ設定や STYLE.md も更新し、違反を検出できるか、修正後のコミットを誤検出しないかを確かめてからコミットします。
レビューで繰り返し伝えているコーディング規約を、次回から適用できるルールとして残したいときに使えます。対象はJavaに限らず、Markdown、YAML、シェルなど、レビューで読むファイル全般です。ひとつの変更に複数の規約が混在する場合や、既存ルールとの重なりを判断できない場合は、内容を確認して利用者に選択を求めます。
ルールの検証には pr-reviewer/review.sh を実行できる環境が必要です。SourceFormatterがすでに修正する内容はルール化せず、処理を止めます。
この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Add a new rule to pr-reviewer/rules, derived from a Git commit or from a reviewer's comment on a pull request. Anyone can use this to encode a convention they spotted in a commit or were asked to follow in review. Rules can apply to any file type the reviewer reads (Java, .properties, XML, JSP, Markdown, Gradle, YAML, shell, and so on), so do not bias toward Java.
A Git commit SHA, or the text of a review comment together with the commit or pull request it was made on.
Optional: a hint about which aspect of the commit to encode. Commits often touch multiple things, and a hint narrows the scope.
Inspect the commit's full diff, or the comment and the code it points at. Identify a single learnable convention that a future reviewer could apply mechanically to other code. Stop and ask the user to clarify when:
Multiple distinct rules are present. Ask the user to pick one, or run the skill once per rule.
The commit mixes convention changes with logic or refactoring changes that cannot be separated.
The pattern is not generalizable beyond the specific file or context.
Read the existing rules in pr-reviewer/rules and pr-reviewer/STYLE.md and compare them against the pattern. When the pattern duplicates or substantially overlaps an existing rule, flag it to the user and ask whether to skip, extend the existing rule, or proceed anyway. When the pattern is enforced by SourceFormatter already, say so and stop, since the reviewer would only repeat what the formatter fixes.
Pick the category by the leading digit of the existing files (0xx convention, 1xx naming, 2xx ordering, 3xx utility methods, 4xx control flow, 5xx redundancy, 6xx tests, 7xx prose, 8xx visibility, 9xx formatting) and take the next free number in it. When no group in _GROUPS at the end of pr-reviewer/review.sh covers the new number's leading digits, add them to the group of that category, since review.sh reviews no rule outside a group. Create pr-reviewer/rules/<number>-<kebab-case-imperative-title>.md with this shape, matching the existing files:
# <number>: <Title Case Imperative Title>
One or two paragraphs stating the rule, with code in inline backticks.
A paragraph starting **Rationale:** that explains what consistency the rule buys, not what the rule does.
A paragraph starting A violation is ... that defines the boundary of the rule and names what not to flag.
A paragraph starting **Example:** that cites the commit or pull request in prose. Follow it with a diff fence when a before and after reads faster than prose, using abstract identifiers (foo, Bar, methodA) rather than the commit's literal code, so the example illustrates the pattern instead of overfitting it to one case.
Write the file the way the rules themselves demand: no hyphens in prose (rule 701), each paragraph on one line (rule 708), complete sentences, and no trailing newline at the end of the file (rule 908).
When the rule belongs to a section of pr-reviewer/STYLE.md, add a bracketed reference to it there.
Validate that the reviewer catches the violation with the new rule in place. Review the reverse of the commit, which reintroduces the violation:
pr-reviewer/review.sh --json <sha>..<sha>~1
The output must include a violation whose rule is the new number, on the file and line the commit changed. When it does not, revise the rule and repeat. Then review the commit itself, <sha>~1..<sha>, and confirm the new rule reports nothing, so the rule does not flag the fix it describes.
After the self test passes, stage the new rule file and any STYLE.md change and commit with this message:
<ticket> Add rule <number> derived from <sha>
まだレビューはありません。使ってみた感想をお寄せください。
ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。
まだコメントはありません。最初のコメントを書いてみませんか。
Liferayのソースコードを対象に、対応する整形ツールとルールを使って形式をそろえ、生成ファイルを避けながら修正対象を確認できます。
不具合の説明や修正コミットから必要事項を整理し、再現手順や期待・実際の動作を含むバグチケットをLPDプロジェクトのJiraに登録できます。
説明やコミット内容をもとに、必要な情報を整えてLPDプロジェクトのJiraにタスクを登録し、チケット番号と閲覧URLを受け取れます。
Liferay向けのMarkdown文書を、前付けの順序や見出しの表記、シェル記法、文章の調子まで整え、リポジトリの規約に沿った読みやすい形に仕上げます。
LiferayのPoshi `.testcase` を内容に応じてPlaywright、Jest、JUnit、Java統合テストへ移行し、既存テストとの重複や移行を妨げる条件も整理します。
LiferayコンポーネントのPoshiテストを調べ、重複するテストを統合・整理する計画を立ててから、確認しやすい単位でテスト数を減らします。