Coder Social home page Coder Social logo

Comments (13)

lonix1 avatar lonix1 commented on July 24, 2024 1

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.

lonix1 avatar lonix1 commented on July 24, 2024 1

@maxild

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.

maxild avatar maxild commented on July 24, 2024 1

https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-tools&package=Microsoft.CodeAnalysis.CSharp.CodeStyle&protocolType=NuGet

from editorconfig.

maxild avatar maxild commented on July 24, 2024

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.

RehanSaeed avatar RehanSaeed commented on July 24, 2024

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.

lonix1 avatar lonix1 commented on July 24, 2024

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.

RehanSaeed avatar RehanSaeed commented on July 24, 2024

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.

maxild avatar maxild commented on July 24, 2024

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

dotnet/roslyn#49250 (comment)

from editorconfig.

maxild avatar maxild commented on July 24, 2024

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.

maxild avatar maxild commented on July 24, 2024

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.

RehanSaeed avatar RehanSaeed commented on July 24, 2024

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.

RehanSaeed avatar RehanSaeed commented on July 24, 2024

Raised dotnet/roslyn#55542

from editorconfig.

RehanSaeed avatar RehanSaeed commented on July 24, 2024

Fixed in #75

from editorconfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.