DotNetAnalyzers / PublicApiAnalyzer

Superseded by Microsoft.CodeAnalysis.PublicApiAnalyzers
https://www.nuget.org/packages/Microsoft.CodeAnalysis.PublicApiAnalyzers/
Other
18 stars 9 forks source link

VB autoproperties are not analyzed. #34

Open CyrusNajmabadi opened 5 years ago

CyrusNajmabadi commented 5 years ago

Simple repro:

Public Class Class1
    Public Property A As Integer
End Class

Expected: Analyzer complains that 'A' is not part of the publicapi file.

Actual: Analyzer does not complain at all.

CyrusNajmabadi commented 5 years ago

Tagging @mavasani @sharwell

Note: i have a potential fix here. I've verified it manually. But this repo doesn't have VB tests, so i'm not sure how to make a full test for it.

mavasani commented 5 years ago

@CyrusNajmabadi If you are looking at enhancing the public API analyzer that we use for Roslyn.sln, then you want to look in the roslyn-analyzers repo at https://github.com/dotnet/roslyn-analyzers/blob/master/src/Roslyn.Diagnostics.Analyzers/Core/DeclarePublicAPIAnalyzer.cs. We have an open community PR to add the same functionality in roslyn-analyzers repo, but that change proposes a breaking change to the public API text, which seems much less preferable.

Just as an FYI: The public API analyzer in this repo (PublicApiAnalyzer) was a fork from the original implementation in roslyn-analyzers repo, primarily to enable publishing a separate NuGet package just with this analyzer (Roslyn.Diagnostics.Analyzers NuGet package also contains other Roslyn.sln specific analyzers). We had a work item somewhere to consolidate both analyzers so we avoid this confusion, but that hasn't happened yet.

CyrusNajmabadi commented 5 years ago

Ah, good to know. I'll move things over there.

CyrusNajmabadi commented 5 years ago

@mavasani can you help me with that repo. The instructions say this:

    Clone the repository
    Restore and build: build.cmd
    Execute tests: test.cmd

However, neither build.cmd or test.cmd exist. There is a cibuild.cmd. But it fails for me with:

  Feeds used:
    C:\Users\cyrus\AppData\Local\NuGet\Cache
    C:\Users\cyrus\.nuget\packages\
    https://api.nuget.org/v3/index.json
    https://www.myget.org/F/roslyn-nightly/
    https://www.myget.org/F/dotnet-core/
    https://dotnet.myget.org/F/roslyn/api/v3/index.json

  Error loading lock file 'C:\github\roslyn-analyzers\src\Microsoft.ApiDesignGuidelines.Analyzers\Core\project.lock.json' : Value cannot be null.
CyrusNajmabadi commented 5 years ago

Ignore me entirely. my fork is hugely out of date.

CyrusNajmabadi commented 5 years ago

Dupe of https://github.com/dotnet/roslyn-analyzers/issues/821

sharwell commented 5 years ago

@CyrusNajmabadi Not a duplicate of dotnet/roslyn-analyzers. This is an extracted implementation of the Public API Analyzer that works is any repository, as opposed to the much more limited implementation in roslyn-analyzers.