Adds an XHPAST linter rule for empty block statements. Basically, if a block statement is empty then it is much neater if the opening ({) and closing (}) braces are adjacent. Maybe this is just my own personal preference, in which case we could reduce the default severity to ArcanistLintSeverity::SEVERITY_DISABLED.
Details
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARC04de9311511d: Add an XHPAST lint rule for empty block statements
Wrote unit tests. I had to modify a bunch of existing unit tests accordingly.
Diff Detail
Diff Detail
- Repository
- rARC Arcanist
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
In normal code I think empty bodies should usually have an explanatory comment (e.g., why the exception is OK to drop on the ground in an empty catch block, or what a loop-acting-through-side-effects is doing) although I wouldn't want to force that. This rule seems OK for blocks without a comment.
src/lint/linter/__tests__/xhpast/undeclared-variables.lint-test | ||
---|---|---|
128–129 | Maybe add a comment here instead, this seems less readable than the old version was. |