Use EditorConfig to apply file headers#452
Conversation
|
One issue I found is that, with script, we can customize where and how we check and apply the header text but with Roslyn analyzer fixer, only source files (i.e. Also, it seems to only warn/error in IDE and not in console builds. Do we need to provide an updated script that provides the missing features in the analyzer fixer? |
CommunityToolkit.Common/Attributes/NotNullIfNotNullAttribute.cs
Outdated
Show resolved
Hide resolved
da95664 to
f520a84
Compare
This is not good, we need the behavior to be the same and builds to fail if the header is not correct everywhere. |
It does error out for both missing header and mismatched header but when I tried to build via Also, do we want file headers to be added for other files (other than |
|
The current behavior was just to add the header to .cs files, yeah. It's fine to omit it in other files. The important thing is that the CI should fail like before if any .cs file has an invalid header, so we do need the |
- Use 'file_header_template' to specify our header text in EditorConfig so that the supported formatters can use it automatically when formatting files.
- Previous Commit added support for Analyzer Fixer based file header
addition to source code files. One was missing and wasn't updated
through the script since the script only checks starting newline
or a single comment line which were not enough to fix the file.
- Fortunately, the Analyzer caught this as IDE0073 style error and
was able fix with a simple click on the suggestion icon in VS IDE.
NOTE: Previous Commit was supposed to fail to demonstrate
build failure when using `file_header_template`.
f520a84 to
a264dfb
Compare
|
🎊 The build successfully failed! 🙌 I never thought I would say this with much enthusiasm. 😅 There was a file Now the |
Sergio0694
left a comment
There was a problem hiding this comment.
This is awesome, love it! Thanks! 😄
|
@michael-hawker I can't view pipeline console and logs anymore. The page errors out with |
|
@Nirmal4G I'm not aware of any changes here, does the link open in an inprivate tab? The Azure DevOps can be pretty odd sometimes about authentication even though they should all be public links afaik. |
|
@michael-hawker Yep, it seems to open in InPrivate. 🤔 Why does InPrivate works but not regular way? I do clear all browsing data on session end even on regular tabs. Hmm..., Weird Issue! |

Changes
file_header_templateto specify our header text in EditorConfig so that the supported editors can use it.build/Update-Headers.ps1script since the IDE Analyzer Fixer (IDE0073) took over its functionality.build/header.txtas the text is embedded in EditorConfig file.PR Checklist
Other information
Rebase or Squash merge the PR and set its message to title and description.