Lombiq / .NET-Analyzers

.NET code analyzers and code convention settings for Lombiq projects.
BSD 3-Clause "New" or "Revised" License
10 stars 7 forks source link

Analysis rules are bing ignored #65

Closed scleaver closed 2 years ago

scleaver commented 2 years ago

Been using Lombiq.Analyzers as a submodule for a while but recently every analysis error is being thrown including ones disabled in the rules file like as if they don't exist.

If I disable below it makes no difference.

<Project>
  <ItemGroup> 
      <Analyzer Remove="@(Analyzer)" /> 
  </ItemGroup>
</Project>

Or via the command line using /p:RunCodeAnalysis=false - no difference.

It still is fine in our build pipeline however if I bring down the source code into a new computer - same issue.

Typical error example are: error CA1707: Remove the underscores from member name Kast.ConnectCard.Constants.FeatureIds.Kast_ConnectCard_OnUs

I copied Lombiq's open source project and copied the configuration from there but this made no difference.

Piedone commented 2 years ago

Just to rule out environmental issues: What happens if you clone https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions (be sure to clone with --recurse-submodules since it uses submodules) and build it? That solution has everything set up for code analysis but doesn't have any violations, so your Error List should be empty.

scleaver commented 2 years ago

Yes I have built the Lombiq OSOCE solution and i builds fine on my Mac and Windows. My project however does not build successfully on either OS.

Piedone commented 2 years ago

OK, so we can rule out that there's some generic problem with the project.

Did you update .NET Analyzers before you first started to see these issues? Check out release notes here: https://github.com/Lombiq/.NET-Analyzers/releases

scleaver commented 2 years ago

I solved it. I had another props file (which I have had for like a year with no issues) which decided it would start overriding the Lombiq analyzers settings all of a sudden.

scleaver commented 2 years ago

Thanks for your perseverance @Piedone

Piedone commented 2 years ago

I see. Sometimes analyzers work in mysterious ways :).