[dotnet] update formatting rules#17019
Conversation
|
Thank you, @titusfortner for this code suggestion. The support packages contain example code that many users find helpful, but they do not necessarily represent After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks. |
PR TypeCleanup Description
|
| Relevant files | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cleanup | 26 files
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Configuration changes | 1 files
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Formatting | 48 files
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Additional files | 101 files
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
There was a problem hiding this comment.
Pull request overview
This PR updates the .NET .editorconfig file to explicitly define code formatting and style rules, then applies automated formatting fixes across the codebase. The changes establish a foundation for enforcing consistent code style in the .NET binding through CI.
Changes:
- Configures explicit formatting rules in
.editorconfig(whitespace, indentation, spacing, namespace declarations) - Applies automated formatting fixes for import ordering, readonly fields, unnecessary assignments, null-conditional operators, and naming conventions
- Removes obsolete code analysis suppressions
Reviewed changes
Copilot reviewed 274 out of 274 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/.editorconfig | Adds comprehensive formatting and style rules including import ordering, namespace declarations, and specific IDE diagnostics |
| dotnet/test/**/*.cs | Reorders imports to place System namespaces first and fixes naming conventions (e.g., testShouldSetBooleanPreferences → ShouldSetBooleanPreferences) |
| dotnet/test/**/DriverTestFixture.cs | Adds pragma to suppress IDE1006 for legacy public member names |
| dotnet/test/**/DefaultWaitTest.cs | Adds readonly modifier to startDate field |
| dotnet/test/**/EventFiringWebDriverTest.cs | Fixes event handler naming to use PascalCase, removes unnecessary assignments |
| dotnet/test/common/**/AssemblyTeardown.cs | Reorders imports across multiple test assemblies |
| dotnet/test/common/**/Environment/*.cs | Removes unnecessary variable initializations and simplifies code |
| dotnet/src/webdriver/**/*.cs | Reorders imports, adds readonly modifiers to fields, uses null-conditional operators for event invocations |
| dotnet/src/webdriver/GlobalSuppressions.cs | Removes obsolete code analysis suppressions |
| dotnet/src/support/GlobalSuppressions.cs | Removes obsolete code analysis suppressions |
| dotnet/src/support/Events/EventFiringWebDriver.cs | Simplifies event invocations using null-conditional operator |
nvborisenko
left a comment
There was a problem hiding this comment.
Left minor comments to double check. If somebody can verify there is no hidden bugs, let's proceed further. Thanks.
|
@RenderMichael & @nvborisenko I just reverted the 2 commits that were concerning. Ideally one or both of you can go through the TODO section in editorconfig and add the things you want to see. I think the more consistent we are with common formatting practices across the project the better. Another thing I didn't address here, but our test class names are all over the place. Should the bee |
@RenderMichael / @nvborisenko
Please look at the individual commits. If there is a style change that you don't think we should make, we need to change the rule in editorconfig.
We aren't hand-editing anything in this PR except the
.editorconfig🔗 Related Issues
Replaces #17011 (and a follow-on to #16999)
The previous PR was too much and too opaque
💥 What does this PR do?
🔧 Implementation Notes
//bazel:format -- styleas part of linting process for things that can be automatically fixed, but IDE1006 cannot, so while the code has been updated to pass it, it has been marked suggestion instead of warning, so we can enforce it in a separate CI run.💡 Additional Considerations
🔄 Types of changes