-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Style checking for core #7516
Style checking for core #7516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except the newline for single line blocks.
Also, do we want |
I discussed this with @heaths and he thought it won't matter since the rules are only applied when one runs dotnet format or used the editorconfig plugin for vscode. For the various other editors that have native support for editorconfig I guess it will still be an issue. The other options will be to keep .editorconfig inside the service folder. |
Just doing format document in VS would apply our styles to their code. |
Maybe we should keep .editorconfig inside the package folders since there seems to be no way to add exclusion or scope in the root .editorconfig file |
I think it would be the safest option for now, we might need a script to syncronize them later. |
Another option might be to try path wildcard matching for styles, like:
|
What exactly didn't work? It still applied styles to track 1 sources? |
Yes, it still runs style check on Track 1, and Management. |
I just tried an experiment where I put the following content in .editorconfig in the repo root and it worked, i.e. *.cs files under sdk/keyvault/Azure.* used tabs (ick), but when I even just opened an individual file from sdk/keyvault/Microsoft.* it still used spaces.
|
I'll try that again. |
Also, what editor are you using? I used Visual Studio 2019 that supports .editorconfig natively. I'd be surprised, though, if some editor/extension supported enough of the pattern to apply to certain files but not within a directory. That would be a bug, given https://editorconfig.org documents the pattern as supported. |
Actually I was testing by running dotnet format which applied the editorconfig rules regardless of the specified path. |
In my experience, it's pretty buggy. But what's the desired result here? If we just want to get track 2 libraries on par with .editorconfig we could run dir sdk/*/Azure.* -recurse -filter *.csproj | foreach { dotnet format -w $_.fullname } After that, conforming editors would at least suggest - if not err, depending on rule severity - changes when editing files. That's all .editorconfig is good for, really. It's violations won't break the build. For that, you need Roslyn Analyzers / StyleCop (the new ones, which are RAs). |
You are right. dotnet format is only for the initial code fixes after which I shouldn't be used. I will test again and then likely to use the paths as you suggested. |
4148a98
to
d3e0600
Compare
… stylecop for core
d3e0600
to
c5773d1
Compare
… stylecop for core (Azure#7516)
Move .editorconfig to Repo Root.
Run dotnet format for Azure.Core to fix style errors.
Turn on Style Cop for Azure.Core
Fix Style Cop errors for Azrue.Core