ashfurrow / danger-ruby-swiftlint

A Danger plugin for SwiftLint.
https://rubygems.org/gems/danger-swiftlint
MIT License
203 stars 81 forks source link

[Bug] dependencies / bundler integration fails to properly update #153

Closed bsrz closed 3 years ago

bsrz commented 4 years ago

Problem

Running $ bundle update ends up in downgrading the library or downgrading danger itself if version is locked.

Setup

Ruby version: 2.6.5 Using rbenv

Contents of Gemfile:

source 'https://rubygems.org'

gem 'cocoapods'
gem 'colorize'
gem 'danger'
gem 'danger-swiftlint'
gem 'fastlane'
gem 'pry-byebug'
gem 'sekrit'
gem 'slather'
gem 'terminal-table'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)

Contents of Gemfile.lock (the relevant part):

    danger (8.0.4)
      claide (~> 1.0)
      claide-plugins (>= 0.9.2)
      colored2 (~> 3.1)
      cork (~> 0.1)
      faraday (>= 0.9.0, < 2.0)
      faraday-http-cache (~> 2.0)
      git (~> 1.7)
      kramdown (~> 2.0)
      kramdown-parser-gfm (~> 1.0)
      no_proxy_fix
      octokit (~> 4.7)
      terminal-table (~> 1)
    danger-swiftlint (0.24.3)
      danger
      rake (> 10)
      thor (~> 0.19)

Running bundle update (the relevant part):

$ bundle update
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...................
[...]
Using danger 8.0.5 (was 8.0.4)
Using danger-swiftlint 0.3.0 (was 0.24.3)
[...]
Bundle updated!

Contents of Gemfile.lock after update (the relevant part):

    danger (8.0.5)
      claide (~> 1.0)
      claide-plugins (>= 0.9.2)
      colored2 (~> 3.1)
      cork (~> 0.1)
      faraday (>= 0.9.0, < 2.0)
      faraday-http-cache (~> 2.0)
      git (~> 1.7)
      kramdown (~> 2.3)
      kramdown-parser-gfm (~> 1.0)
      no_proxy_fix
      octokit (~> 4.7)
      terminal-table (~> 1)
    danger-swiftlint (0.3.0) # uh oh!
      danger

Forcing the version in the Gemfile using gem 'danger-swiftlint', '~> 0.24' results in downgrading danger itself:

$ bundle update
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies............................................
[...]
Using git 1.5.0 (was 1.7.0)
[...]
Using thor 0.20.3 (was 1.0.1)
[...]
Using sekrit 0.1.0 (was 0.2.0)
Using danger 0.8.2 (was 8.0.4)
Using danger-swiftlint 0.24.4 (was 0.24.3)
[...]
Bundle updated!
Jeehut commented 4 years ago

Same issue here. I could workaround this by specifying gem 'danger-swiftlint', '>=0.24.3' in my Gemfile. But I suppose that the issue lies in Bundler gem itself as that's where the decision for the version is made (I assume). I guess there's something wrongly matching 3 to be higher than 24 by just looking at the first digit (2).

ashfurrow commented 4 years ago

Thanks for the issue! Yeah good thinking @Jeehut, seems to be the case. @bsarrazin which bundler version are you using? Seems really weird that this wouldn't be working ...

bsrz commented 4 years ago

@ashfurrow my apologies for the delay. I am using bundler 2.1.4, which I think is the latest?

I was also seeing a conflict with a gem of mine. So I'm thinking maybe that was the source of conflict. Take a look https://rubygems.org/gems/sekrit/ I think you have far deeper Ruby knowledge than I do. Any feedback is appreciated!

Looks like tweaking the dependency versions and releasing 0.3.0 has fixed it. 🤞

bsrz commented 3 years ago

Closing this since it's pretty old and seems to be fixed.