Open Bug 1485040 Opened Last year Updated Last year

Fix mode lines and indentation in .webidl files

Categories

(Core :: DOM: Bindings (WebIDL), enhancement, P3)

enhancement

Tracking

()

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(6 files, 1 obsolete file)

I just realized that my modeline.py script [1] only runs on .cpp and .h (well, and .cc) files, so .webidl files aren't being covered. It would be good to fix those up.

[1] https://github.com/amccreight/moz-source-tools/blob/master/modeline.py/
Priority: -- → P3
Assignee: nobody → continuation
490 of these files have a header thing that includes "The origin of this IDL file is:" then some other information afterwards in the MPL block, so I'll have to adjust my script to allow those.
Component: DOM → DOM: Bindings (WebIDL)
Never mind, my script seems to deal with that already.
I guess the real hassle here is that a number of files are 4 space indented instead of 2 space indented. Maybe I'll fix them up, if they aren't too big. (For instance, WebGLRenderingContext.webidl is 4 space indented, so I'm going to leave that one alone...)
I fixed the indentation issues my script found in most files, except for dom/webidl/WebGLRenderingContext.webidl, dom/webidl/WebGPU.webidl and dom/webidl/WebGL2RenderingContext.webidl. I added mode lines, but not the MPL, to the files in dom/bindings/mozwebidlcodegen/test/, because having the MPL headers on test files seems a little weird.
This is the script used to generate the automatic fixes and find the other problems that I manually fixed. Note that you need to edit the loop at the bottom to skip any files in your objdir. Something like:

  if base.startswith("<full objdir path>"):
    continue
Summary: Run modeline.py on .webidl files → Fix mode lines and indentation in .webidl files
MozReview-Commit-ID: DYMdVo1tO6a

Depends on D4156
MozReview-Commit-ID: JVgOCbO2nn6

Depends on D4157
MozReview-Commit-ID: 8X4XDj3JOpe

Depends on D4158
This patch was generated by my modeline.py script.

MozReview-Commit-ID: 5T8JeCO858N

Depends on D4159
I canceled the review on the last patch. It looks like there's an IDL mode that should be used instead of C++.
This patch was generated by my modeline.py script.

MozReview-Commit-ID: EbVjPLwiUAT

Depends on D4159
Attachment #9003624 - Attachment is obsolete: true
Comment on attachment 9003620 [details]
Bug 1485040, part 1 - Switch line endings from DOS to Unix in WebIDL files

Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) has approved the revision.
Attachment #9003620 - Flags: review+
Comment on attachment 9003621 [details]
Bug 1485040, part 2 - Fix indentation in some WebIDL files

Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) has approved the revision.
Attachment #9003621 - Flags: review+
Comment on attachment 9003622 [details]
Bug 1485040, part 3 - Add missing modeline/licenses to WebIDL files

Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) has approved the revision.
Attachment #9003622 - Flags: review+
Comment on attachment 9003623 [details]
Bug 1485040, part 4 - Add mode lines, but not the MPL, to some test files

Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) has approved the revision.
Attachment #9003623 - Flags: review+
Comment on attachment 9003627 [details]
Bug 1485040, part 5 - Automatically fix mode lines in WebIDL files

Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) has approved the revision.
Attachment #9003627 - Flags: review+
Er, was part 5 supposed to be reviewed after the update? I went ahead and did it anyways then realized the order things happened in.
(In reply to Kyle Machulis [:qdot] [:kmachulis] (if a patch has no decent commit message, automatic r-) from comment #18)
> Er, was part 5 supposed to be reviewed after the update? I went ahead and
> did it anyways then realized the order things happened in.

Yeah there's still a part 5. I'm going to land the one with mode: IDL instead of C++. Also I realized I need to fix up some of the earlier files in the same way.
This is currently blocked on bug 1489565. Maybe I should just figure out how to land this myself.
Depends on: 1489565
Attachment #9003620 - Attachment description: Bug 1485040, part 1 - Switch line endings from DOS to Unix in WebIDL files. r=qDot → Bug 1485040, part 1 - Switch line endings from DOS to Unix in WebIDL files
Attachment #9003621 - Attachment description: Bug 1485040, part 2 - Fix indentation in some WebIDL files. r=qDot → Bug 1485040, part 2 - Fix indentation in some WebIDL files
Attachment #9003622 - Attachment description: Bug 1485040, part 3 - Add missing modeline/licenses to WebIDL files. r=qDot → Bug 1485040, part 3 - Add missing modeline/licenses to WebIDL files
Attachment #9003623 - Attachment description: Bug 1485040, part 4 - Add mode lines, but not the MPL, to some test files. r=qDot → Bug 1485040, part 4 - Add mode lines, but not the MPL, to some test files
Attachment #9003627 - Attachment description: Bug 1485040, part 5 - Automatically fix mode lines in WebIDL files. r=qDot → Bug 1485040, part 5 - Automatically fix mode lines in WebIDL files
Pushed by amccreight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a9622e7761eb
part 1 - Switch line endings from DOS to Unix in WebIDL files r=qdot
https://hg.mozilla.org/integration/autoland/rev/0fbb490ffc7f
part 2 - Fix indentation in some WebIDL files r=qdot
https://hg.mozilla.org/integration/autoland/rev/806c36cb2c4c
part 3 - Add missing modeline/licenses to WebIDL files r=qdot
https://hg.mozilla.org/integration/autoland/rev/c567c4c7438f
part 4 - Add mode lines, but not the MPL, to some test files r=qdot
https://hg.mozilla.org/integration/autoland/rev/b417c2d937e8
part 5 - Automatically fix mode lines in WebIDL files r=qdot
Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=busted&revision=b417c2d937e8b0a4987e61b1d47efae4435a3fde&selectedJob=199158673

Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=199158673&repo=autoland&lineNumber=41306

Backout link: https://hg.mozilla.org/integration/autoland/rev/86dc76e74294e7c25a2d582d144b8da5f986af20

[task 2018-09-13T20:02:13.386Z] 20:02:13     INFO - ============================= test session starts ==============================
[task 2018-09-13T20:02:13.386Z] 20:02:13     INFO - platform linux2 -- Python 2.7.9, pytest-3.6.2, py-1.5.4, pluggy-0.6.0 -- /builds/worker/workspace/build/src/obj-firefox/_virtualenvs/src-UL-dti-o-2.7/bin/python
[task 2018-09-13T20:02:13.386Z] 20:02:13     INFO - rootdir: /builds/worker/workspace/build/src, inifile: /builds/worker/workspace/build/src/config/mozunit/mozunit/pytest.ini
[task 2018-09-13T20:02:13.386Z] 20:02:13     INFO - collecting ... collected 9 items
[task 2018-09-13T20:02:13.386Z] 20:02:13     INFO - ../dom/bindings/mozwebidlcodegen/test/test_mozwebidlcodegen.py::TestWebIDLCodegenManager::test_copy_input PASSED
[task 2018-09-13T20:02:13.386Z] 20:02:13  WARNING - ../dom/bindings/mozwebidlcodegen/test/test_mozwebidlcodegen.py::TestWebIDLCodegenManager::test_generate_build_files TEST-UNEXPECTED-FAIL
Flags: needinfo?(continuation)
bz pointed out that I should probably not change the indentation on WebIDL files that are derived from actual specs, because it will make diffing harder. Though diff -w would work. ;) Also, adding the MPL to spec'ed files may not make sense. He said they might be for some things like Window and Element because those may have originated based on Mozilla nsIFoo files rather than the spec.

Anyways, I may just end up WONTFIXing this, as a broad brush fix like this may not be appropriate and I'm not sure I really want to dig through the history of a few dozen WebIDL files.
Flags: needinfo?(continuation)
You need to log in before you can comment on or make changes to this bug.