Skip to content

liferay/liferay-portal / .claude/skills/pr-check

pr-check

Verified

Check that a PR is ready to be sent for review.

FileKindSize
SKILL.mdskill md36.5 KB
find_modules.shexecutablescript1.4 KB
references/testing.mdmarkdown5.4 KB
select_paths.shexecutablescript2.2 KB
select_validations.shexecutablescript1.1 KB
validations/branch/bean-param-util-getter.mdmarkdown6.6 KB
validations/branch/bnd-content.mdmarkdown15.2 KB
validations/branch/bnd-dsannotations-options.mdmarkdown9.1 KB
validations/branch/cache-field-usage.mdmarkdown13.9 KB
validations/branch/concurrent-mapper-hash-map-usage.mdmarkdown7.5 KB
validations/branch/html-escaping.mdmarkdown2.6 KB
validations/branch/pr-reviewer.mdmarkdown6.6 KB
validations/branch/redundant-assert-message.mdmarkdown13.5 KB
validations/branch/required-configuration-policy.mdmarkdown7.9 KB
validations/branch/service-holder-usage.mdmarkdown8.3 KB
validations/branch/service-registration.mdmarkdown3.7 KB
validations/branch/source-format.mdmarkdown4.1 KB
validations/branch/startup-sync-usage.mdmarkdown10.6 KB
validations/branch/transaction-usage.mdmarkdown4.0 KB
validations/branch/unused-project-dependencies.mdmarkdown18.5 KB
validations/portal/baseline.mdmarkdown14.0 KB
validations/portal/cross-module-compile.mdmarkdown7.9 KB
validations/portal/full-portal-build.mdmarkdown1.4 KB
validations/portal/go-generate.mdmarkdown2.8 KB
validations/portal/go-source-format.mdmarkdown1.9 KB
validations/portal/helm-unit-test-order.mdmarkdown1.4 KB
validations/portal/instance-wrapper-build.mdmarkdown656 B
validations/portal/java-unit-test.mdmarkdown6.7 KB
validations/portal/javascript-unit-test.mdmarkdown7.7 KB
validations/portal/module-registration.mdmarkdown7.8 KB
validations/portal/per-module-compile.mdmarkdown10.4 KB
validations/portal/portlet-title.mdmarkdown1.1 KB
validations/portal/poshi-syntax.mdmarkdown336 B
validations/portal/pql-validation.mdmarkdown516 B
validations/portal/rest-builder.mdmarkdown938 B
validations/portal/service-builder.mdmarkdown1.6 KB
validations/portal/structural-smoke.mdmarkdown3.9 KB
validations/portal/theme-build.mdmarkdown2.0 KB
validations/workspaces/generated-file.mdmarkdown2.5 KB
validations/workspaces/source-format.mdmarkdown2.0 KB
validations/workspaces/workspace-compile.mdmarkdown1.8 KB
validations/workspaces/workspace-java-unit-test.mdmarkdown1.7 KB
validations/workspaces/workspace-javascript-unit-test.mdmarkdown1.9 KB

validations/branch/source-format.md

View on GitHub
# Source Format

## Match

`.`

## Preconditions

- SDK

## Command

Run the source formatter in `current-branch` mode:

```bash
(cd "${REPO_ROOT}/portal-impl" && ANT_OPTS="-Xmx2560m -Dgit.working.branch.name=${MERGE_BASE}" ant format-source-current-branch -Dvalidate.commit.messages=true)
```

A nonzero formatter is a finding, and never read it as an environment failure, however much it looks like one: an unfixable violation surfaces as `Unable to execute Gradle task: :portalYarnFormatCurrentBranch` on the last line or two, which is indistinguishable from a broken toolchain and is why the violations have to be read from the middle of the log. The accompanying `finished with non-zero exit value 1` line sits further up, inside the stack trace, and names the node binary by its full path rather than as `command node`, so search it as a substring or not at all.

Two formatters run here and they fail differently, at opposite ends of the log. Search for both, and do not read a clean Java side as a pass, since a run where every `SourceCheck` violation was fixed and committed can still be failing on the yarn side:

```bash
command grep --fixed-strings 'SourceCheck:' "${LOG}"
command grep --fixed-strings 'ERROR: Dependency' "${LOG}"
```

Neither pattern is anchored, because Ant prefixes the yarn output with `[exec]` and indents it, so a search for `^ERROR:` matches nothing at all. The Java violations arrive in the first dozen lines, the yarn ones about three fifths of the way down, and the terminal Gradle error on the last line or two, so a tail of any reasonable size shows the failure while hiding what caused it.

The yarn side does not always run. `portal-impl/build.xml` sets `skip.node.task` when no changed file matches the frontend regex in `build.properties`, which covers `js`, `json`, `jsp`, `jspf`, `scss`, `ts`, and `tsx`, so a diff of none of those skips `downloadNode`, `yarnInstall` and the yarn formatter entirely. An empty yarn search on such a diff means the formatter never ran rather than that it ran clean, and neither is a failure. Say which of the two happened.

`-Dvalidate.commit.messages=true` is passed explicitly because `format-source-current-branch` never sets it and only the `format-source` target does, so the commit message rules CI enforces go unchecked without it. The flag produces no output of its own, and a clean check and a check that never ran print alike, so there is nothing in a normal run to confirm from. When it matters, rerun under `ant -v`, which echoes the `SourceFormatter` argv and shows `validate.commit.messages=true` among it.

Pass `git.working.branch.name` in `ANT_OPTS` rather than on the command line, since the yarn side lists its files through a separate `ant git-util` call that inherits nothing else. Pass `${MERGE_BASE}` rather than a branch tip, since the formatter compares the working tree with that commit, and a tip newer than the branch shows its later changes as reversed.

## Autocommit

When `git status --porcelain` is nonempty after the formatter (fixable subset applied to the working tree), stage the tracked modifications with `git add --update` and create a commit titled `<TICKET> SF`.

Use `--update` rather than `--all`. The formatter edits files that already exist, so `--update` covers everything it does, while `--all` also sweeps in whatever else is untracked in the tree at that moment. The **SDK** precondition runs `ant setup-sdk` before the formatter, which reaches `downloadNode` and `yarnInstall` on the way, and the output of all three stays out of the commit only because `.gitignore` happens to cover it. List the staged files against the paths the formatter named before committing, and report any it did not.

When the commit fails, record the failure and continue to the next validation.

Unfixable violations exit nonzero and fail this validation; surface them from the formatter output in the final report. When both fixable and unfixable violations occur in one run, the autocommit captures the fixable subset; the unfixable subset still blocks the run.

## Notes

Run **after** all drift validations so the formatter sees the regenerated tree.

## Time Estimate

~2-4 min. It scales with the number of changed files.
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall