Page MenuHomePhabricator

Make the "Is this JSON?" DocumentEngine heuristic a little tighter
ClosedPublic

Authored by epriestley on Jul 27 2018, 6:29 PM.
Tags
None
Referenced Files
F13190625: D19544.id.diff
Sat, May 11, 12:32 PM
F13182277: D19544.id46725.diff
Thu, May 9, 10:24 PM
F13180491: D19544.id46725.diff
Thu, May 9, 12:24 AM
Unknown Object (File)
Tue, May 7, 9:30 AM
Unknown Object (File)
Mon, May 6, 6:12 PM
Unknown Object (File)
Fri, May 3, 9:18 AM
Unknown Object (File)
Thu, May 2, 11:59 AM
Unknown Object (File)
Thu, May 2, 4:13 AM
Subscribers
None

Details

Summary

See PHI749. Ref T13164. We currently misdetect files starting with [submodule ... as JSON.

Make this a bit stricter:

  • If the file is short, just see if it's actually literally real JSON.
  • If the file is long, give up.

This should get the right result in pretty much all the cases people care about, I think. We could make the long-file guesser better some day.

Test Plan

Detected a [submodule ... file (no longer JSON) and a {"duck": "quack"} file (still JSON).

Diff Detail

Repository
rP Phabricator
Branch
json1
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 20522
Build 27871: Run Core Tests
Build 27870: arc lint + arc unit