Comments (13)
Yeah I thought as much. It's unfortunate they don't publish an "official" set like they do for code analysis rules.
Defaulting to warning probably makes sense. Having a GUI tool like you mentioned in that other thread, makes even more sense. Something like those online gitignore tools would be cool. I'd do that myself if I had the time 😞
from editorconfig.
You have to use microsoft.codeanalysis.csharp.codestyle.3.9.0-xxxxxx preview builds to get those files for explicit/recommended code style (IDExxxx) severity settings from there CI-feed
I checked this nupkg but it only has code quality rules. There aren't code style rules in there.
Am I looking at the right package?
Wish dotnet was more like GO (gofmt) wrt code styles
YES!!! Code style is such a waste of time, gofmt does it right.
from editorconfig.
from editorconfig.
I have been working/following the code analysis .editorconfig
/.globalconfig
based changes in the .NET 5 SDK where code styles and code quality have been built into the sdk to be more cross-plat, and found your repo.
I am sure you already know, but just to be precise...
I guess what you mean is the following
# We currently use both the old
# csharp_prefer_braces = when_multiline:warning
# syntax and the new
# csharp_prefer_braces = when_multiline
# dotnet_diagnostic.IDE0011.severity = warning
# syntax (side-by-side, mixed, ??) as in
# csharp_prefer_braces = when_multiline:warning
# dotnet_diagnostic.IDE0011.severity = warning
# After 16.9 the old syntax should not be needed anymore
# but we should still probably keep it around for backward compatability.
# See also https://github.com/dotnet/roslyn/issues/44201#issuecomment-761672157
This should probably be put into the .editorconfig, such that people hand-editing the file will know.
from editorconfig.
Yes that's correct.
We should probably add a comment to that effect. I was hoping that we could transition to the new syntax by now so we wouldn't need to but that seems to have been delayed to VS 16.9. I'm also trying to understand when the old syntax will be deprecated but don't have an answer to that yet.
from editorconfig.
Are the severities in your editorconfig based on your personal preference, or an official MS source?
They publish a "default" set of severities for the code analysis rules, but I haven't found one for the code style rules.
So I'm wondering how you decided on the severities for your config?
from editorconfig.
We default to warning in all cases except very few where making it a hard requirement may make the code worse. We should probably review them. Using warnings has the advantage of giving developers the ability to use TreatWarningsAsErrors
.
from editorconfig.
They publish a "default" set of severities for the code analysis rules, but I haven't found one for the code style rules.
The SDK uses global analyzer config files also distributed in the nupkg
from editorconfig.
You have to use microsoft.codeanalysis.csharp.codestyle.3.9.0-xxxxxx
preview builds to get those files for explicit/recommended code style (IDExxxx) severity settings from there CI-feed...It is experimental, and will probably first come in .NET 6 SDK?
I would argue that it is very difficult to enforce any styles for all projects. But with AnalysisMode/AnalysisLevel the SDK is trying. Therefore any editorconfig (also https://github.com/RehanSaeed/EditorConfig/blob/main/.editorconfig) is just a starting point.
Wish dotnet was more like GO (gofmt) wrt code styles.
from editorconfig.
Using warnings has the advantage of giving developers the ability to use TreatWarningsAsErrors.
This will only work probably when 16.9 ship dotnet/roslyn#43051 (comment)
from editorconfig.
Tested migrating from [rule] = [value]:[severity]
syntax to [rule].[RuleId].[severity]
in VS 16.10 and it still doesn't seem to work completely. At some point the old syntax will be deprecated (See dotnet/roslyn#44201). Not sure when that will be.
Raised #57 to fix this. Won't merge until issues are resolved.
from editorconfig.
Raised dotnet/roslyn#55542
from editorconfig.
Fixed in #75
from editorconfig.
Related Issues (20)
- Bad globbing pattern for csharp section HOT 1
- Suggestion: dotnet new tool HOT 4
- Improved .editorconfig compliance with .NET guidelines HOT 26
- Add Sample Project HOT 3
- File Header Comments
- A severity must be specified on modifier preferences HOT 1
- Renaming master Branch to main HOT 1
- csharp_using_directive_placement = inside_namespace don't warn about using outside namespace HOT 11
- Wrong scope for dotnet severity HOT 1
- New Settings in VS 16.10 HOT 3
- Adding .editorconfig breaks TreatWarningsAsErrors HOT 6
- New Settings in VS 16.11 HOT 6
- Support for .razor files HOT 3
- Version 4.1.0 still says "4.0.0" on the file header HOT 1
- Is there a rule to control empty line between class members declaration HOT 2
- New Spell Check Setting HOT 1
- Is there a way to enforce const to be real Pascal Case only? HOT 1
- New Formerly Experimental Settings HOT 1
- Support New Settings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from editorconfig.