Page MenuHomePhabricator

Add lint rules for `=>` (fat arrow) and `.` (string concatenation)
ClosedPublic

Authored by epriestley on May 27 2014, 10:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 15, 1:33 AM
Unknown Object (File)
Sun, Sep 15, 1:32 AM
Unknown Object (File)
Sun, Sep 15, 1:32 AM
Unknown Object (File)
Sun, Sep 15, 1:32 AM
Unknown Object (File)
Sun, Sep 15, 1:31 AM
Unknown Object (File)
Thu, Sep 5, 5:26 PM
Unknown Object (File)
Tue, Aug 27, 1:00 PM
Unknown Object (File)
Sun, Aug 25, 11:43 AM
Subscribers

Details

Summary

We have coverage for normal binary operators, but not these unusual cases.

Test Plan

Added and executed unit tests.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley retitled this revision from to Add lint rules for `=>` (fat arrow) and `.` (string concatenation).
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added reviewers: joshuaspence, btrahan.
joshuaspence edited edge metadata.

I'll accept this because it works and is mostly fine, but there's a couple of minor inlines.

src/lint/linter/ArcanistXHPASTLinter.php
49

Just a though (not really related to this diff), but whenever a new rule is added, I think that the output of getVersion and getCacheVersion should probably change as well.

109

Also note related to this diff, but these strings should be wrapped in pht?

1971

Do you need keys here? Wouldn't foreach (array($prev, $next) as $wtoken) { achieve the same thing?

This revision is now accepted and ready to land.May 27 2014, 11:08 PM
epriestley edited edge metadata.
  • Bump verison.
  • We should probably pht() everything at some point.
  • To be completely correct, the rule for prev should disallow newlines (i.e., $a\n.$b is not conventional), but that's kind of complicated and I haven't seen anyone doing it so I didn't bother yet.
epriestley updated this revision to Diff 22096.

Closed by commit rARCff97a77786d0 (authored by @epriestley).