]> khamidou — GitHub mirrors - arcanist.git/commit
Add a linter rule to detect the use of blacklisted functions
authorJoshua Spence <josh@joshuaspence.com>
Sun, 4 Jan 2015 23:51:33 +0000 (10:51 +1100)
committerJoshua Spence <josh@joshuaspence.com>
Sun, 4 Jan 2015 23:51:33 +0000 (10:51 +1100)
commitd477df00eb5b357f953e693b6d99c13551edeb3f
treeedc28e75b826b3846ac15d296c2550436ff30003
parenteb3129408bbafa4608b42b2405d614f79632cb1d
Add a linter rule to detect the use of blacklisted functions

Summary:
As mentioned in the [[https://secure.phabricator.com/book/phabcontrib/article/php_coding_standards/ | Phabricator PHP coding standards]], the `eval` function should be avoided. There is some good discussion on [[http://stackoverflow.com/questions/951373/when-is-eval-evil-in-php | StackOverflow]] as well.

Having said that, instead of hardcoding `eval()`, I have generalised this enough to allow a set of "blacklisted" functions to be defined with `xhpast.blacklisted.function` in the `.arclint` file.

Test Plan: Added a test case.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10686
.arclint
src/lint/linter/ArcanistXHPASTLinter.php
src/lint/linter/__tests__/xhpast/blacklisted.lint-test [new file with mode: 0644]