-
-
Notifications
You must be signed in to change notification settings - Fork 258
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
Formatting analyzer that checks existence/format of a file/license header #1516
Comments
Hi @siegfriedpammer, I think this would be very useful analyzer. Thank you for the initiative. Regarding the idea of regex, Do we really need it when defining a file header? If you have multiple headers in your solution you can configure it with multiple editorconfig files. What would be really useful in my opinion would be to provide functionality to replace old header with a new one. That would require to define option with "old" file header. I see that you provided a list of options which is great. Could you provide a list of real editorconfig options with keys and values. It would be better to agree on the options before the implementation starts. Thanks. References:
|
Thank you for the quick response!
For me the primary use case for a regex is not defining multiple file headers, but rather to allow file headers to have some dynamic elements such as copyright year or different author names for example (taken from the ILSpy project):
which would be generalized as:
This is the flexibility that is missing from https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0073 and the reason for this proposal.
I agree...
Will do so, but it might take some time since I am not very familiar with the editorconfig conventions yet. Thank you very much for providing some references! |
I could implement this in my own package, but it might be useful for other people, so I am creating an issue here.
While dotnet format has a rule for file headers, it is not really configurable, it only can check for static text. Things like copyright year numbers or different author names, which could easily be covered by a simple regex, cannot be configured.
Options:
I would be willing to implement this.
The text was updated successfully, but these errors were encountered: