dependabot / dependabot-core

🤖 Dependabot's core logic for creating update PRs.
https://docs.github.com/en/code-security/dependabot
MIT License
4.65k stars 1k forks source link

Dependabot does not consider ignore rule #9201

Open jscarle opened 7 months ago

jscarle commented 7 months ago

Is there an existing issue for this?

Package ecosystem

nuget

Package manager version

No response

Language version

netstandard2.0

Manifest location and content before the Dependabot update

https://github.com/jscarle/AttributeSourceGenerator/blob/main/src/AttributeSourceGenerator/AttributeSourceGenerator.csproj

    <ItemGroup>
        <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all"/>
        <PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" PrivateAssets="all"/>
    </ItemGroup>

dependabot.yml content

https://github.com/jscarle/AttributeSourceGenerator/blob/main/.github/dependabot.yml

version: 2
updates:
  - package-ecosystem: "nuget"
    directory: "/"
    schedule:
      interval: "weekly"
    ignore:
      - dependency-name: "Microsoft.CodeAnalysis.CSharp"

Updated dependency

Microsoft.CodeAnalysis.CSharp 4.3.1 => 4.9.2

What you expected to see, versus what you actually saw

Ignore should be respected and PR should not be opened.

Native package manager behavior

No response

Images of the diff or a link to the PR, issue, or logs

https://github.com/jscarle/AttributeSourceGenerator/pull/4

Smallest manifest that reproduces the issue

version: 2
updates:
  - package-ecosystem: "nuget"
    ignore:
      - dependency-name: "Microsoft.CodeAnalysis.CSharp"
brettfo commented 5 months ago

Investigating a bit, it looks like if no version ranges are specified like in your scenario, the core updater ends up passing the string ">= 0" which winds its way through and when we eventually do version range matching, that's not a valid NuGet version range, so it doesn't apply. The fix could be as simple as rewriting ">= 0" to "*", but the updater is currently undergoing a rewrite in C#.

jscarle commented 5 months ago

You'd think that "ignore" would be clear enough.