SeleniumHQ / SeleniumHQ/selenium

[🚀 Feature]: Improve .NET formatting / linting

Open
#17,023 1 comment 0 reactions 0 assignees View on GitHub
C-dotnet I-enhancement
Dominant language
Java
Stars
34.5k
Forks
8.7k
Avg merge
2d 1h
Merged PRs (30d)
92

Description

### Description

#17019 created the scaffolding and #17020 added the execution for .NET linting and formatting.

The issue is to dig deeper into what things in the .NET codebase can be improved by explicit rules and consistency. Ideally it is obvious how to add good code in .NET based on the rules we have an enforce.

I'm honestly not sure how much we need or how much is enough, but I know there is more work that can be done.

### Have you considered any alternatives or workarounds?

This is what I have in `dotnet/.editorconfig` right now for specific enforcement. The idea is to add anything that can be automatically fixed that we want to enforce as a warning, and anything that we want to enforce but can't be automatically fixed by `bazel run //dotnet:format -- style` / `bazel run //dotnet:format -- whitespace`

```
dotnet_diagnostic.IDE0044.severity = warning # Make field readonly
dotnet_diagnostic.IDE0076.severity = warning # Invalid suppression
dotnet_diagnostic.IDE1005.severity = warning # Delegate invocation

# TODO: Additional violations to investigate
# The following are the number of violations for each diagnostic;
# They currently fail at info, the goal is to fix and explicitly set to warning above
# Investigate with `dotnet format style --diagnostics IDEXXXX --severity info`
# 1183 IDE0090
# 633 IDE0028
# 252 IDE0290
# 169 IDE0077
# 66 IDE0130
# 65 IDE0300
# 57 IDE1005
# 42 IDE0017
# 39 IDE0039
# 36 IDE0063
# 33 IDE0306
# 31 IDE0083
# 30 IDE0016
# 30 IDE0059
# 26 IDE0305
# 18 IDE0031
# 12 IDE0270
# 11 IDE0057
# 11 IDE0054
# 9 IDE0350
# 9 IDE0074
# 7 IDE0060
# 3 IDE0150
# 2 IDE0038
# 1 IDE0056
# 1 IDE0034
# 1 IDE0018
# ? IDE1006
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.