SA1402 does not take topLevelType setting into account for records
See original GitHub issue1.2.0-beta.507
In our stylecop json we have:
"maintainabilityRules": {
"topLevelTypes": [ "class" ]
}
But still it warns about files containing more than one record. It’s fine if the default for topLevelTypes has changed to include records but not being able to configure it at all is inconvenient.
Issue Analytics
- State:
- Created 3 months ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
SA1402 does not fire for record classes · Issue #3542
Expected behavior: SA1402 is reported for record classes, same as for non-record classes. C# version: 10.0 StyleCopAnalyzers: 1.2.0-beta.406, ...
Read more >StyleCop SA1402 and Generics
I think SA1402 is a great rule but I have problem with generics. I've got a class that uses the Func delegate, so...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sharwell We opted to disable SA1402 and create our own that only requires class and struct to be in separate files instead of hundreds of
#pragmas
. If you change your mind in the future we can just revert that change.Yeah, more configuration options would have been great. We have many command handler classes which include the commands as records with 1- 3 members (i.e. one-liners), adding a suppression to each file is not nice. I guess we’ll disable SA1402 for these particular folders in .editorconfig.