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
F14121228: D19544.id46726.diff
Fri, Nov 29, 11:51 AM
Unknown Object (File)
Wed, Nov 27, 11:05 PM
Unknown Object (File)
Sun, Nov 24, 12:33 PM
Unknown Object (File)
Sat, Nov 23, 7:12 AM
Unknown Object (File)
Sat, Nov 23, 5:47 AM
Unknown Object (File)
Sat, Nov 23, 2:51 AM
Unknown Object (File)
Oct 18 2024, 11:21 AM
Unknown Object (File)
Oct 16 2024, 9:48 PM
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