Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix and disallow all snake_case style warnings #25531
Comments
|
Hi! If you have any questions regarding this issue, feel free to make a comment here, or ask it in the If you intend to work on this issue, then add |
|
@highfive: assign me |
|
Hey @kunalmohan! Thanks for your interest in working on this issue. It's now assigned to you! |
|
How should I translate camelCase methods (of webidl) to snake_case? I found |
|
That must be why ignore_snake_case was on in the first place. Maybe we want just the autogenerated method names from the webidl to be exempt from this, somehow? |
|
Yes, we can apply that attribute to specific modules or trait implementations when necessary, I suppose. We can start by making use of the |
|
Adding servo/components/script/dom/bindings/codegen/CodegenRust.py Lines 1958 to 1965 in 1de9290 doesn't seem to reduce any warnings. Adding it to and gave the respective errors-
|
|
Can you give a few examples of some of the warnings? |
|
One other possibility is changing this line to |
|
|
txPower actually should have a snake case name, and tx_power is the correct suggestion, if I understand Servo's style correctly. Constructor's a word the codegen is putting in a trait, so it should probably be exempt? |
|
Yes, I think so too. There are a large number of variables and functions that come under the warnings. I guess most of the variables` names need to be changed whereas the functions are put in by the codegen and should be exempt. |
|
I can't figure out where the actual |
This isn't working: python servo/components/script/dom/bindings/codegen/CodegenRust.py Lines 6335 to 6344 in 1de9290 So I tried
which again gave the error |
Only for the constructors? (because there are hundreds of warnings, constructors alone are more than a hundred I guess |
|
For non-constructor methods of traits, you can probably add |
Modify `script` to prevent further violations of snake_case <!-- Please describe your changes on the following line: --> Remove `#![allow(non_snake_case)]` from `script/lib.rs` and add `#[allow(non_snake_case)]` at each instance of violation. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25531 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Modify `script` to prevent further violations of snake_case <!-- Please describe your changes on the following line: --> Remove `#![allow(non_snake_case)]` from `script/lib.rs` and add `#[allow(non_snake_case)]` at each instance of violation. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25531 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Modify `script` to prevent further violations of snake_case <!-- Please describe your changes on the following line: --> Remove `#![allow(non_snake_case)]` from `script/lib.rs` and add `#[allow(non_snake_case)]` at each instance of violation. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25531 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Modify `script` to prevent further violations of snake_case <!-- Please describe your changes on the following line: --> Remove `#![allow(non_snake_case)]` from `script/lib.rs` and add `#[allow(non_snake_case)]` at each instance of violation. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #25531 (GitHub issue number if applicable) <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
https://github.com/servo/servo/blame/5c7a4db5f4e374dee287d403d90c7bc0e07ac9d0/components/script/lib.rs#L12 was added several years ago. We should remove it and fix the existing violations that have been added to the code in that time.