Closed
Bug 1479515
Opened 6 years ago
Closed 2 years ago
Add manually run linter rules for detecting reference of undefined constants in interfaces and accessing valid properties of Services
Categories
(Developer Infrastructure :: Lint and Formatting, task, P2)
Developer Infrastructure
Lint and Formatting
Tracking
(firefox106 fixed)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: standard8, Assigned: standard8)
References
(Blocks 1 open bug)
Details
Attachments
(3 files, 1 obsolete file)
In the dependencies on bug 1479513, you'll see various cases where we do things like:
Ci.nsIFoo.BAR
and BAR is undefined as it isn't in the interface.
Ideally we should have an automated way to catch this. It is probably a job for static analysis.
Assignee | ||
Comment 1•6 years ago
|
||
This is the patch I whipped up for ESLint. The basic idea here is:
1) Find any item which looks like Ci.IFoo.bar
2) Load the interface JSON information from the hard-coded objdir path `objdir-ff-opt/config/makefiles/xpidl/` (if not already loaded)
3) Search through the interfaces for the IFoo definition
4) Search through the interface definition `consts` value for `bar`
5) If `bar` is not found, repeat 3 and 4 for any parents until `nsISupports` is hit.
This isn't really suitable for ESLint in production at the moment as:
- here is the obvious build dependency.
- I'm not convinced this should be ESLint's role, as this is doing more in-depth analysis.
However, maybe there is another way, or this could be hooked up to static analysis of some kind.
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
Assignee | ||
Updated•2 years ago
|
Assignee: nobody → standard8
Assignee | ||
Comment 2•2 years ago
|
||
In this bug we'll get these landed in a way that they can be run manually from ESLint when you have a full build. Bug 1666491 will deal with the hook-up to automation.
Blocks: 1666491
Severity: normal → N/A
Status: NEW → ASSIGNED
Type: enhancement → task
Priority: -- → P2
Summary: Investigate if we can add a linter for detecting reference of undefined constants in interfaces → Add manually run linter rules for detecting reference of undefined constants in interfaces and accessing valid properties of Services
Assignee | ||
Comment 3•2 years ago
|
||
This is manually run and requires a full build. MOZ_OBJDIR needs to be set to point to the object directory.
Depends on D156421
Assignee | ||
Comment 4•2 years ago
|
||
Depends on D156424
Assignee | ||
Comment 5•2 years ago
|
||
This is manually run and requires a full build. MOZ_OBJDIR needs to be set to point to the object directory.
Depends on D156425
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 6•2 years ago
|
||
I still need to do a lot of tidy up on these patches, the WIP are posting so there's a copy here as well.
Assignee | ||
Updated•2 years ago
|
Attachment #8996024 -
Attachment is obsolete: true
Updated•2 years ago
|
Attachment #9293100 -
Attachment description: WIP: Bug 1479515 - Add an ESLint rule to check for unknown property accesses on Ci. → Bug 1479515 - Add an ESLint rule to check for unknown property accesses on Ci. r?Gijs
Updated•2 years ago
|
Attachment #9293101 -
Attachment description: WIP: Bug 1479515 - Extend the ESLint rule for checking Ci properties to check for unknown interfaces as well. → Bug 1479515 - Extend the ESLint rule for checking Ci properties to check for unknown interfaces as well. r?Gijs
Updated•2 years ago
|
Attachment #9293102 -
Attachment description: WIP: Bug 1479515 - Add an ESLint rule to check for valid property accesses on Services. → Bug 1479515 - Add an ESLint rule to check for valid property accesses on Services. r?Gijs
Assignee | ||
Comment 7•2 years ago
|
||
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4bc3e077b7a2
Add an ESLint rule to check for unknown property accesses on Ci. r=Gijs
https://hg.mozilla.org/integration/autoland/rev/5086e62b92ed
Extend the ESLint rule for checking Ci properties to check for unknown interfaces as well. r=Gijs,application-update-reviewers,nalexander
https://hg.mozilla.org/integration/autoland/rev/5eb9e59194ee
Add an ESLint rule to check for valid property accesses on Services. r=Gijs
Comment 9•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4bc3e077b7a2
https://hg.mozilla.org/mozilla-central/rev/5086e62b92ed
https://hg.mozilla.org/mozilla-central/rev/5eb9e59194ee
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
status-firefox106:
--- → fixed
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•