SonarSource/sonar-dotnet

Fix SA1010 FP: Use new collection initializer should not issue a warning SA1010

Closed this issue · 2 comments

Description

When using the new collection initializer [] no SA1010 should be raised.

Repro steps

List<string> list = [];

Expected behavior

No warning.

Actual behavior

Warning SA1010 Opening square brackets should not be preceded by a space

Known workarounds

None

Related information

  • C# 12
  • Visual Studio 17.9.7
  • MSBuild 17.9.8.16306 / dotnet 8.0.5
  • Windows 10

Hi @Willimaendu,

We do not maintain StyleCop SA* rules. You need to follow this repository:
https://github.com/DotNetAnalyzers/StyleCopAnalyzers