cake-contrib / CakeContrib.Guidelines

Adds common guidelines to cake-contrib projects
https://cake-contrib.github.io/CakeContrib.Guidelines/
MIT License
2 stars 4 forks source link

(#296) implemented CCG0010 #272

Closed nils-a closed 10 months ago

nils-a commented 10 months ago

To warn if an addin/module references a package that is already provided by Cake.

fixes #296

codecov[bot] commented 10 months ago

Codecov Report

Attention: 14 lines in your changes are missing coverage. Please review.

Comparison is base (808de13) 94.30% compared to head (7d96d57) 94.33%.

Files Patch % Lines
src/Tasks/CheckCakeInternalReferences.cs 94.38% 4 Missing and 6 partials :warning:
src/Tasks/TargetFrameworkVersions.cs 42.85% 0 Missing and 4 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #272 +/- ## =========================================== + Coverage 94.30% 94.33% +0.02% =========================================== Files 14 16 +2 Lines 650 829 +179 Branches 94 111 +17 =========================================== + Hits 613 782 +169 - Misses 16 20 +4 - Partials 21 27 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nils-a commented 10 months ago

@augustoproiete what do you think?

My test contains the following references:

<ItemGroup>
  <PackageReference Include="Cake.Core" Version="3.0.0" privateAssets="all" />
  <PackageReference Include="NuGet.Common" Version="5.11.0"  />
  <PackageReference Include="CakeContrib.Guidelines" Version="1.4.0-gh-296-0001">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>
</ItemGroup>

Note, how the NuGet.Common reference is in the correct version for Cake 2.0.0, but not for version 3.0.0. Also privateAssets is not set.

Building this project results in the following build warnings:

...\ClassLibrary1.csproj : warning CCG0010: NuGet.Common is provided by Cake 3.0.0 in version 6.3.1. Do not reference a different version. (see https://cake-contrib.github.io/CakeContrib.Guidelines/rules/ccg0010) [TargetFramework=net6.0] ...\ClassLibrary1.csproj : warning CCG0010: NuGet.Common is provided by Cake. It should have PrivateAssets="all" set (see https://cake-contrib.github.io/CakeContrib.Guidelines/rules/ccg0010) [TargetFramework=net6.0]