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
F15549428: D19544.id.diff
Sun, Apr 27, 5:40 AM
F15545114: D19544.diff
Sat, Apr 26, 9:01 AM
F15525641: D19544.id.diff
Mon, Apr 21, 3:49 PM
F15486581: D19544.diff
Thu, Apr 10, 8:13 AM
F15481006: D19544.id46725.diff
Tue, Apr 8, 5:45 PM
F15478143: D19544.id46726.diff
Mon, Apr 7, 8:45 PM
F15443942: D19544.id.diff
Mar 27 2025, 6:59 AM
F15439789: D19544.diff
Mar 26 2025, 9:29 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
Lint
Lint Not Applicable
Unit
Tests Not Applicable