Currently, the ArcanistSpellingLinter loads data from ArcanistSpellingDefaultData, with no way to configure the linter from an .arclint file. Instead we should define a format for a "dictionary" file, of which the ArvcanistSpellingLinter can load and of which the paths are easily configured through .arclint.
Details
- Reviewers
epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARC494d974005eb: Move `ArcanistSpellingDefaultData` into a configurable JSON file
Updated the test case and ran arc unit.
Diff Detail
- Repository
- rARC Arcanist
- Branch
- spellinglinter
- Lint
Lint Passed Severity Location Code Message Advice src/lint/linter/ArcanistSpellingLinter.php:103 XHP16 TODO Comment - Unit
Tests Passed - Build Status
Buildable 1493 Build 1493: [Placeholder Plan] Wait for 30 Seconds
Event Timeline
src/lint/linter/ArcanistSpellingLinter.php | ||
---|---|---|
106 | Consider defining this relative to phutil_get_library_root('arcanist') so the class doesn't mysteriously stop working if it is moved. |
src/lint/linter/ArcanistSpellingLinter.php | ||
---|---|---|
103–108 | Do you think that this is the right approach? The alternative would be to require that a spelling linter explicitly load all relevant dictionaries (which would break backwards compatibility). Another thought is that perhaps dictionaries should be able to be specified relative to the resources/spelling directory. i.e. if "spelling.dictionaries": ["foo/bar.json"] then a dictionary would be loaded the first existing path out of:
|
src/lint/linter/ArcanistSpellingLinter.php | ||
---|---|---|
76 | Ironically, I appear to have misspelled "misspelling". |
I think the given approach is reasonable. Copy/pasting the base data into your project or copy-pasting it to start your local file seem like mostly approaches (you aren't really going to miss that much by us adding 3 more words per year to the upstream) and they let you remove words. If there's a ton of demand for it or something we could add another config option later to include it explicitly, e.g.:
spelling.dictionaries = custom.json spelling.include-default-dictionary = true
But I'd guess this won't come up for, like, at least a year.
Yeah, I don't want to overcomplicate it right now (YAGNI). But I do want to add spelling.rules.exact and spelling.rules.partial configuration.
The spelling.include-default-dictionaries option is nice because it offers a more-sane way to provide a default without extending the .arclint stuff to support a default value.
resources/spelling/english.json | ||
---|---|---|
2 | Any thoughts on why there's no syntax highlighting on JSON files? I can't remember if this is happening on my local install. |