Page MenuHomePhabricator

Add a native JSON linter.
ClosedPublic

Authored by joshuaspence on Jun 19 2014, 3:46 AM.
Tags
None
Referenced Files
F14071348: D9628.diff
Wed, Nov 20, 5:14 PM
Unknown Object (File)
Tue, Nov 19, 3:35 AM
Unknown Object (File)
Wed, Nov 13, 3:09 AM
Unknown Object (File)
Fri, Nov 1, 10:33 PM
Unknown Object (File)
Thu, Oct 31, 11:44 AM
Unknown Object (File)
Fri, Oct 25, 4:08 AM
Unknown Object (File)
Thu, Oct 24, 1:23 PM
Unknown Object (File)
Oct 9 2024, 1:21 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
Branch
jsonlint
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1239
Build 1239: [Placeholder Plan] Wait for 30 Seconds

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".