Skip to content

(#296) implemented CCG0010#272

Merged
nils-a merged 3 commits intocake-contrib:developfrom
nils-a:feature/GH-296
Nov 18, 2023
Merged

(#296) implemented CCG0010#272
nils-a merged 3 commits intocake-contrib:developfrom
nils-a:feature/GH-296

Conversation

@nils-a
Copy link
Copy Markdown
Contributor

@nils-a nils-a commented Oct 20, 2023

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

fixes #296

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 20, 2023

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 ⚠️
src/Tasks/TargetFrameworkVersions.cs 42.85% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@             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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nils-a
Copy link
Copy Markdown
Contributor Author

nils-a commented Oct 20, 2023

@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]

the first generator is "package-reference" that can find
all package references that should be considered when
creating addins or modules for cake.
so the can be used in multiple tasks
To warn if an addin/module references
a package that is already provided by Cake.
@nils-a nils-a merged commit 6d75df0 into cake-contrib:develop Nov 18, 2023
@nils-a nils-a deleted the feature/GH-296 branch November 18, 2023 19:18
cake-contrib-bot pushed a commit that referenced this pull request Nov 18, 2023
Merge pull request #272 from nils-a/feature/GH-296

(#296)  implemented CCG0010
@nils-a nils-a linked an issue Nov 18, 2023 that may be closed by this pull request
Copy link
Copy Markdown
Member

@augustoproiete augustoproiete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn if a plugin depends on a package that is already included in Cake

2 participants