1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 09:38:50 +02:00
phorge-arcanist/src/lint
epriestley 3ae1bf1a8c Add a lint check for clobbering locals with iterators
Summary:
See D2049, D2050. Identify reuses of locals as iterator variables. Before raising an error, we require:

  - Variable is declared before the loop.
  - Variable is used after the loop, ignoring uses as an iterator variable.

I think this identifies all problems with a very low false positive rate (the false positives are suspicious/unconventional code, but not necessarily errors).

Also fix an issue identified by the linter.

Test Plan:
  - Verified this identified the bugs in D2049 and D2050.
  - Ran linter against libphutil/, arcanist/ and phabricator/ (see D2051, this, and next diff).
  - Ran unit tests.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran, epriestley, jungejason

Differential Revision: https://secure.phabricator.com/D2052
2012-03-29 13:21:18 -07:00
..
engine Raise a lint error when code uses a PHP 5.3 feature in Phabricator 2012-03-09 13:51:02 -08:00
linter Add a lint check for clobbering locals with iterators 2012-03-29 13:21:18 -07:00
message Minor Arcanist fixes 2012-03-29 13:21:10 -07:00
patcher Stop arc from destroying files under HPHPi. 2011-02-24 14:08:49 -08:00
renderer Avoid double indenting in console wrapping 2012-03-28 22:28:15 -07:00
result Minor Arcanist fixes 2012-03-29 13:21:10 -07:00
severity Finalize Arcanist Classes 2012-01-31 12:07:05 -08:00