Page MenuHomePhabricator

Add a native JSON linter.
ClosedPublic

Authored by joshuaspence on Jun 19 2014, 3:46 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Mar 10, 2:38 AM
Unknown Object (File)
Feb 16 2024, 12:41 AM
Unknown Object (File)
Feb 11 2024, 12:24 AM
Unknown Object (File)
Jan 6 2024, 11:21 AM
Unknown Object (File)
Dec 27 2023, 2:03 PM
Unknown Object (File)
Dec 27 2023, 2:03 PM
Unknown Object (File)
Dec 27 2023, 2:03 PM
Unknown Object (File)
Dec 27 2023, 2:03 PM
Subscribers

Details

Summary

Ref T5297. Utilize PhutilJSONParser to create a native JSON linter (native in that it is pure PHP with no external dependencies).

Since JsonLint is literally a PHP port of jsonlint, I figured that we should also deprecate ArcanistJSONLintLinter. ArcanistJSONLinter should behave identically to ArcanistJSONLintLinter.

Depends on D9634.

Test Plan

Ran the ArcanistJSONLintLinter unit tests.

Diff Detail

Repository
rARC Arcanist
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

joshuaspence retitled this revision from to Add a native JSON linter..
joshuaspence updated this object.
joshuaspence edited the test plan for this revision. (Show Details)
joshuaspence added a reviewer: epriestley.

Possibly just remove ArcanistJSONLintLinter entirely, and instead map the jsonlint key to ArcanistJSONLinter. This is probably preferably since there isn't really a good way to deprecate linters, and is probably acceptable since the output from both linters should be approximately equal.

I'm supportive of removal -- you added JSONLint pretty recently anyway, right? And it wasn't in response to a specific "we want jsonlint specifically" request?

I think we can do a better job with this native version, and users won't have to install stuff.

We could restore "jsonlint" as a separate linter in the future if someone wants it specifically for some reasonable technical reason ("we use it elsewhere").

epriestley edited edge metadata.

Oh, although I think having this one as "json" and jsonlint as "jsonlint" is fine too. I'm not too worried about overhwelming users with a lot of linters, since that's going to happen anyway and will be an issue we need to resolve regardless of how many JSON linters there are.

This revision is now accepted and ready to land.Jun 19 2014, 6:02 PM
joshuaspence edited edge metadata.
  • Use phutil_json_decode
  • Revert ArcanistJSONLinter to use PhutilJSONParser

Yes, this is a lot slower than phutil_json_decode, but its probably going to needed anyway since we will probably get requested such as "allow comments in JSON files".