Closed jrmoreno1 closed 4 days ago
Is this something you'd accept a PR for, and if so would you want it to be under configuration control (i.e. editorconfig setting) or just something it did automatically given the expected prefixes?
@sharwell , @CyrusNajmabadi ?
It looks like only you have requested this in an this time. Probably a better approach is to simply exclude these files from that analyzer in your editorconfig file.
@CyrusNajmabadi : I understand saying I'm possibly the only person in the world that wants this (based on no votes in nearly 4 years), but this is quite literally every single file in such projects. The link has rotted, but at the time it was to official MS documentation and that was the naming convention. Every button on every page will be prefixed with btn, every text input field will be prefixed with txt and so forth. MS's recommendation was followed religiously.
Excluding individual files with this convention from such projects is just another way of saying exclude the analyzer from the projects.
@jrmoreno1 Another option here would be to define a DiagnosticSuppressor
which suppresses IDE1006 from these cases.
I believe the WinForms designer was updated a while back to generate event handler methods which meet the coding styles automatically, so this shouldn't be as much of a problem for new code as old.
@sharwell : Thanks for the info about diagnostic suppressor, hadn’t heard of them before
@sharwell : is there a sample diagnostic suppressor project with unit tests out that I could use as a starting point? Unlike analyzers there doesn’t seem to be a template project (and the analyzer template doesn’t include a suppressor project)
Closing out due to lack of broad feedback, the ability to suppress through editorconfig, and the ability to use a diagnostic suppressor.
Version Used: 16.4
Steps to Reproduce:
Create a project that uses either winforms or asp.net forms, create a control using what was previously the recommended naming pattern:
For example:
Expected Behavior:
No warnings for either the btnOK declaration or the btnShowFrom2 event handelr.
Actual Behavior: IDE1006 Naming Violation for both.
==== The prefix is apps hungarian, and fairly standardized. btn, txt, lbl, ddl.
It would be great if there was some way to exclude these wholesale. There are just too many of them to exclude or change individually.