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
F18812582: D19544.id.diff
Mon, Oct 20, 10:37 AM
F18760332: D19544.id46725.diff
Mon, Oct 6, 9:01 AM
F18618132: D19544.id46726.diff
Sep 14 2025, 11:15 PM
F18597401: D19544.diff
Sep 13 2025, 2:47 AM
F18509706: D19544.id.diff
Sep 5 2025, 3:33 AM
F18503028: D19544.diff
Sep 4 2025, 10:49 PM
F18396780: D19544.diff
Aug 29 2025, 12:48 PM
F18393866: D19544.id46726.diff
Aug 29 2025, 9:31 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