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

Improve S1264: Update RSPEC to include using initialization for simple assignation #8249

Open
sebastien-marichal opened this issue Oct 24, 2023 · 0 comments
Labels
Area: C# C# rules related issues. Type: Improvement Making existing code better.

Comments

@sebastien-marichal
Copy link
Contributor

From this community post.

Update S1264 rspec to include the following snippet as a non-compliant example:

int i;

for (i = 0; i < indexes.Count - 1;)
{ }

A more complex example:

int i;
int j = 3;
for (i = 0, Console.WriteLine($"Start: i={i}, j={j}"); i < j; i++, j--, Console.WriteLine($"Step: i={i}, j={j}"))
{
    //...
}

In other words, anything else than a declaration in the initializer section should be considered as non-compliant.

@sebastien-marichal sebastien-marichal added Type: Improvement Making existing code better. Area: C# C# rules related issues. labels Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Type: Improvement Making existing code better.
Projects
None yet
Development

No branches or pull requests

1 participant