Page MenuHomePhabricator

Add a linter rule for array elements
ClosedPublic

Authored by joshuaspence on Aug 10 2015, 1:38 PM.
Tags
None
Referenced Files
F19304012: D13842.diff
Wed, Dec 24, 6:46 AM
F18818407: D13842.id33457.diff
Oct 22 2025, 12:12 AM
F18817571: D13842.diff
Oct 21 2025, 4:37 PM
F18749822: D13842.id.diff
Oct 4 2025, 5:13 AM
F18745967: D13842.id33456.diff
Oct 3 2025, 10:34 AM
F18712671: D13842.id.diff
Sep 29 2025, 5:30 AM
F18697447: D13842.diff
Sep 27 2025, 9:39 AM
F18601384: D13842.diff
Sep 13 2025, 12:22 PM
Subscribers

Details

Summary

Add a linter rule to ensure that array elements occupy a single line each.

Test Plan

Added test cases.

Diff Detail

Repository
rARC Arcanist
Branch
master
Lint
Lint Passed
Unit
Test Failures
Build Status
Buildable 7574
Build 8188: [Placeholder Plan] Wait for 30 Seconds
Build 8187: arc lint + arc unit

Event Timeline

joshuaspence retitled this revision from to Add a linter rule for array elements.
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.
epriestley edited edge metadata.
epriestley added inline comments.
src/lint/linter/xhpast/rules/ArcanistArrayElementXHPASTLinterRule.php
38 ↗(On Diff #33423)

Maybe check $value->getLineNumber()? Or look at all the nonsemantic tokens? I think this raises a false positive on:

array(
  /* OPEN   */ 1,
  /* CLOSED */ 2,
);

...which is nonstandard in this codebase, but seems reasonable.

This revision is now accepted and ready to land.Aug 10 2015, 1:40 PM
This revision was automatically updated to reflect the committed changes.