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

Changed all occurenceas of var #2803

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

stefannikolei
Copy link
Contributor

To have a consistent code base I changed all usages of var and changed the editorconfig rule to error.

Do you want this things to be on error in the editorconfig?

@JimBobSquarePants
Copy link
Member

Thanks @stefannikolei

I'm into this but we need to make sure two things are in place:

  1. editorconfig changes need to be made upstream in SharedInfrastructure or else they simply get overwritten on build.
  2. We need to ensure we are enforcing Target-typed new expressions so we're not adding noise.

For example:

RowInterval rows = new RowInterval(yMin, yMax); // ❌

RowInterval rows = new(yMin, yMax); // ✔️

The following rule will require updating to error

csharp_style_implicit_object_creation_when_type_is_apparent = true:warning

In addition, we should add a new rule to enforce collection expressions with the same severity.

Use collection initializers or expressions (IDE0028)

@stefannikolei
Copy link
Contributor Author

stefannikolei commented Sep 8, 2024

I tried to do that. I also Affen some Settins vor Rider. These Look good. Some of the editorconfig settings are not supported in rider. Therefore I could not really test those.

Whe this looks good to you I can go forward and fix the stylecop errors. I always get bitten by the no errors in debug mode...

@JimBobSquarePants
Copy link
Member

I tried to do that. I also Affen some Settins vor Rider. These Look good. Some of the editorconfig settings are not supported in rider. Therefore I could not really test those.

Whe this looks good to you I can go forward and fix the stylecop errors. I always get bitten by the no errors in debug mode...

I've merged the changes to the infrastructure repo so you should be good to continue

@stefannikolei
Copy link
Contributor Author

Some build errors are false positives. A bug fix for StyleCop.Analyzer is already implemented but not yet released.
DotNetAnalyzers/StyleCopAnalyzers#3893

@JimBobSquarePants
Copy link
Member

@stefannikolei I've introduced a bunch of conflicts here. Do you want me to fix them or would you have time?

@stefannikolei
Copy link
Contributor Author

Just let it sit until the StyleCopAnalyzers thing is figured out.

Most changes were made by tooling and not by hand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants