1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-09-19 16:38:51 +02:00
Commit graph

9 commits

Author SHA1 Message Date
Joshua Spence
d477df00eb 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
2015-01-05 10:51:33 +11:00
Joshua Spence
494d974005 Move ArcanistSpellingDefaultData into a configurable JSON file
Summary: Currently, the `ArcanistSpellingLinter` loads data from `ArcanistSpellingDefaultData`, with no way to configure the linter from an `.arclint` file. Instead we should define a format for a "dictionary" file, of which the `ArvcanistSpellingLinter` can load and of which the paths are easily configured through `.arclint`.

Test Plan:
Updated the test case and ran `arc unit`.

NOTE: I have removed the `LINT_SPELLING_PICKY` and `LINT_SPELLING_IMPORTANT` constants and replaced them with `LINT_SPELLING_FULL` and `LINT_SPELLING_PARTIAL`. This was done because it simplifies the implementation considerably and makes customization of the `ArcanistSpellingLinter` simpler, but also because these constants were not widely used in the existing implementation.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9805
2014-07-04 08:18:33 +10:00
Joshua Spence
df1491c449 Alphabetize .arclint linters
Summary: I'm a bit OCD with this, but I find the `.arclint` file easier to read if the keys are in alphabetical order.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9804
2014-07-03 11:56:29 +10:00
Joshua Spence
b9b9c138fe Lint JSON files with ArcanistJSONLinter.
Summary: After D9628, we can lint JSON files natively.

Test Plan: Linted a few JSON files manually (i.e. `arc lint --trace -- $FILE`).

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9652
2014-06-23 01:55:48 +10:00
Joshua Spence
46e0553c46 Modernize .arclint file.
Summary:
Update the `.arclint` file after D9576 and D9590.

Depends on D9576, D9590.

Test Plan: Eyeball it.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9591
2014-06-18 02:41:28 +10:00
Joshua Spence
833ce45155 Lint the ArcanistSpellingDefaultData class.
Summary:
Currently, the `ArcanistSpellingDefaultData` is marked with a `@nolint` annotation. This means that it doesn't get linted by any linters. Really, the intention here was to make sure that this file isn't linted by the `ArcanistSpellingLinter` linter.

Now that the `.arclint` file is more mature, we can easily just exclude this file from being linted //only// by the spelling linter, whilst allowing other linters to run.

Test Plan: Ran `arc lint`.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9432
2014-06-09 11:36:00 -07:00
Joshua Spence
0468be3e7f Use the ArcanistChmodLinter.
Summary: Apply the `ArcanistChmodLinter` from D9187.

Test Plan: Removed all other linters from the `.arclint` file and executed `arc lint --everything`. Confirmed that there were no issues raised.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9190
2014-05-18 18:10:12 -07:00
epriestley
7bbafe91d2 Fill out some more info functions for libphutil-specific linters
Summary: Ref T2039. It looks like "phutil-library" didn't make it over, I'll add that to the other two (unless I'm wrong and this isn't an oversight?).

Test Plan: Used `arc linters` to read help.

Reviewers: btrahan, joshuaspence

Reviewed By: joshuaspence

Subscribers: epriestley

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9070
2014-05-12 05:06:04 -07:00
Joshua Spence
b63828a87e Use the ArcanistConfigurationDrivenLintEngine as a linting engine.
Summary: Ref T2039. The `.arclint` file is reasonably complete now and we should start using it if possible, since we are trying to recommend it to others.

Test Plan: `arc lint`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2039

Differential Revision: https://secure.phabricator.com/D9057
2014-05-11 19:33:40 -07:00