Improve the functionality of Lintpref
Categories
(Core :: Preferences: Backend, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: KrisWright, Assigned: KrisWright)
References
Details
Attachments
(4 files)
There's a few things I would like to do for Lintpref before it can start examining more pref files:
-
Have Lintpref get its file paths from the yml file rather than statically checking
all.js
againstStaticPrefList.yaml
. This is the behavior reflected in other linters, and I didn't worry about it at the time since we were only looking atall.js
. In order to write tests for the linter and expand its usage to more files, it's better to get file paths fromlintpref.yml
. -
Improve parsing of
all.js
and other associated prefs files. Right now it just trusts that the pattern of prefs is regular enough to pull the names out, but it could do this more elegantly. It looked at first thatPreferences.read_prefs
was the right function to use to do this, but there's some file format mismatches that causes it to have read errors. There may be another function in the library to do this. Or, I can just write a similar function that reads in prefs as a part of lintpref. -
Detect
value
mismatches in duplicates. This is going to require a lot of consideration - right now,value
is not considered and so we don't do any preprocessing steps. there are a few ways to address this, including storing all of the possible values found in thevalue
field against each pref, and checking them against the *.js files' values as a list. This is useful for files likemobile.js
where there will be a lot of prefs that are overwritten with different values. When there is a value mismatch, the pref can either be ignored completely (since it'll be overwriting the static pref with the new value) or warned as a potential duplicate instead of reporting an error. -
Write test files for Lintpref. The linters now have tests, and lintpref should have tests too. Before, it wasn't possible to really create a test case since it was reading
all.js
exclusively. With the changes in part 1 it will be possible to write tests.
Assignee | ||
Comment 1•5 years ago
|
||
Rather than statically loading the path to all.js
, Lintpref should look at any file paths in lintpref.yml
. Also added the path
field to each error to accommodate multiple files, and a few other code tidiness cleanups.
Assignee | ||
Comment 2•5 years ago
|
||
Replaces the basic pattern-matching in the linter with a more robust regexp. This regexp can strip name
and value
from the pref, which will be useful in part 3 of bug 1587180.
Assignee | ||
Comment 3•5 years ago
|
||
Teaches Lintpref to look at value
matches when considering possible duplicates.
Assignee | ||
Comment 4•5 years ago
|
||
Adds a test for Lintpref and two test files. Also makes some adjustments to lintpref.yml
to improve support file loading.
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 8•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/93362c0a7d69
https://hg.mozilla.org/mozilla-central/rev/a3b383ec343b
https://hg.mozilla.org/mozilla-central/rev/bdf7addb1a8f
https://hg.mozilla.org/mozilla-central/rev/595dbfcecc4b
https://hg.mozilla.org/mozilla-central/rev/af29b78f16dd
Updated•5 years ago
|
Description
•