1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-10-24 17:48:50 +02:00
phorge-arcanist/src/lint/linter/xhpast
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
..
__tests__ Add a lint check for clobbering locals with iterators 2012-03-29 13:21:18 -07:00
naminghook Improve Arcanist symbol name linter 2012-01-28 11:17:45 -08:00
__init__.php Raise a lint warning for classes not marked "abstract", "final" or 2012-01-28 11:29:30 -08:00
ArcanistXHPASTLinter.php Add a lint check for clobbering locals with iterators 2012-03-29 13:21:18 -07:00