]> khamidou — GitHub mirrors - arcanist.git/commit
Add PHP lint check for expressions which can be statically evaluated
authorepriestley <git@epriestley.com>
Mon, 13 Jun 2011 15:58:01 +0000 (08:58 -0700)
committerepriestley <git@epriestley.com>
Mon, 13 Jun 2011 17:17:43 +0000 (10:17 -0700)
commit65c0d0793507dabc384d2ce1d951ee1250842b6a
tree03a26e187f0dce1838fab28fa5dbc7023e132a97
parent42c6f003151f342904e6b5a3e24b244c30036b74
Add PHP lint check for expressions which can be statically evaluated

Summary:
This is pretty coarse and could be refined, but I often do this when testing:

  lang=diff
  - if (some_complicated_condition())
  + if (true || some_complicated_condition())

aran has caught me not only doing it but sending out diffs with it like 30
times. Catch it in lint instead.

Test Plan:
Unit test, added a "true || $junk" to the code and linted it.

Reviewed By: aran
Reviewers: aran, jungejason, tuomaspelkonen, pad
CC: aran
Differential Revision: 447
src/lint/linter/xhpast/ArcanistXHPASTLinter.php
src/lint/linter/xhpast/__tests__/data/tautological-expressions.lint-test