Roslyn: Publish FormattingAnalyzer to MyGet

Created on 16 Oct 2018  路  9Comments  路  Source: dotnet/roslyn

We need to ensure this package gets published to MyGet as part of the signed build process.

This analyzer will be published as a nuget package?
If so when?

_Originally posted by @MarcoRossignoli in https://github.com/_render_node/MDExOlB1bGxSZXF1ZXN0MjA0NDkwNTM2/pull_requests/unread_timeline#issuecomment-430320119_

Area-Infrastructure Resolution-Fixed

Most helpful comment

@MariusVolkhart That's the correct source and package, but you need to make sure to install the latest dated release, which unfortunately isn't the latest numbered release. Right now it's 2.11.0-beta1-63505-03.

All 9 comments

@sharwell until release is there a way to use FormattingAnalyzer?I mean if I compile repo I could do a reference to produced dll from my solutions/projects. If so can you tell me dll name?

I come here from #DotNetAnalyzers/StyleCopAnalyzers#2817. I think the prelease feed is https://dotnet.myget.org/F/roslyn/api/v3/index.json and the package to add is Microsoft.CodeAnalysis.CSharp.CodeStyle, but I don't know where to go from there. EditorConfig settings don't seem to impact the compile process, and I haven't figured out other ways to configure things.

I'm excited to get this to work! I would greatly appreciate any guidance that the team can provide.

@MariusVolkhart That's the correct source and package, but you need to make sure to install the latest dated release, which unfortunately isn't the latest numbered release. Right now it's 2.11.0-beta1-63505-03.

@sharwell I added a ref to package

<ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="2.11.0-beta1-63505-03">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>
    <PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
  </ItemGroup>

I setup Fix formatting to Error, I get correct red underscores but build doesn't fail:

...
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
...

What I'm missing?

@MarcoRossignoli The severity for Formatting Analyzer is currently configurable only via a ruleset file. You'll need to set it to warning or error to get build-time diagnostics.

Note that Formatting Analyzer only enforces the whitespace-related formatting settings, i.e. the items that would be fixed by running Format Document without any of the new Code Cleanup options enabled.

Note that Formatting Analyzer only enforces the whitespace-related formatting settings

Tested and it's ok!
Is there a way to fail also for all other setting on .editorconfig(other than underscores)?

@MarcoRossignoli Not currently. Formatting Analyzer is the first of several code style analyzers which we plan to move from the IDE layers down to a layer where it's usable at compile time.

Ok thank's a lot for explanation!

For those who might arrive here in the future, the rule is IDE0054. Take a look at how to Configure and use Roslyn analyzer rules for more details.

Was this page helpful?
0 / 5 - 0 ratings