style: enforce IDE0090 and use var for simplifiable new expressions - #521
Merged
Merged
Conversation
- Set IDE0090 (simplify 'new' expression) to error via the csharp_style_implicit_object_creation_when_type_is_apparent option. - Convert explicit-type local declarations to var across the test projects to satisfy IDE0090. - Fix pre-existing IDE0005 (redundant using) and IDE0028 (collection initialization) violations in TestUtils that the new Lint gate surfaced. Signed-off-by: currantw <taylor.curran@improving.com>
Signed-off-by: currantw <taylor.curran@improving.com>
… into cleanup_simplify-construction
currantw
commented
Aug 12, 2026
prateek-kumar-improving
approved these changes
Aug 12, 2026
xShinnRyuu
approved these changes
Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In an effort to increase code style consistency, enforces the IDE0090 analyzer rule ("'new' expression can be simplified")
as an error and normalizes the affected declarations on
var.Issue Link
⚪ None.
Features and Behaviour Changes
No behavioural changes. This is a code-style change only.
Type x = new Type(...)) are rewritten asvar x = new Type(...)across the test projects.Implementation
.editorconfig— setcsharp_style_implicit_object_creation_when_type_is_apparent = true:error.Limitations
⚪ None.
Testing
task lint:csharppassesRelated Issues
⚪ None.
Checklist
This Pull Request is related to one issue.(no associated issue)(no docs impact)CHANGELOG.md,README.md,DEVELOPER.md, and other documentation files are updated.mainor releasemain, squash otherwise.