Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorted Usings Analyzer #7571

Open
golddove opened this issue Feb 10, 2025 · 0 comments
Open

Sorted Usings Analyzer #7571

golddove opened this issue Feb 10, 2025 · 0 comments

Comments

@golddove
Copy link

Brief description:

Similar code style rule already exists (dotnet_sort_system_directives_first), but there is no analyzer (see #77024).

This is confusing as it is listed under IDE0055 in MS docs, and looks just like other code style rules which do have analyzers (allowing build enforcement and IDE warning/error markings).

Ideally, also introduce a new code style rule (dotnet_sort_imports) which enables sorted usings independent of System usings order.

Any kind of analyzer that checks for sorted usings would be super useful for avoiding constant code changes from devs who haven't enabled Code Cleanup on save, and would make it easier to enforce it on cli builds too.

Languages applicable:

Both, or C#-only

Code example that the analyzer should report:

Microsoft.Namespace2
Microsoft.Namespace1

or

Microsoft.Namespace1
System.Namespace2
Microsoft.Namespace3

Additional information:

Any more additional information you would like to add.

Documentation requirements:

When this analyzer is implemented, it must be documented by following the steps at Documentation for IDE CodeStyle analyzers.

@CyrusNajmabadi CyrusNajmabadi transferred this issue from dotnet/roslyn Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant