Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "add_dependency vs add_runtime_dependency" rule #943

Conversation

koic
Copy link
Member

@koic koic commented Jul 5, 2024

Follow up rubygems/rubygems#7799 (comment).

Prefer add_dependency over add_runtime_dependency because add_dependency is considered soft-deprecated and the Bundler team recommends add_dependency.

# bad
Gem::Specification.new do |s|
  s.add_runtime_dependency 'gem_a'
end

# good
Gem::Specification.new do |s|
  s.add_dependency 'gem_a'
end

Follow up rubygems/rubygems#7799 (comment).

Prefer `add_dependency` over `add_runtime_dependency` because `add_dependency` is considered soft-deprecated
and the Bundler team recommends `add_dependency`.

```ruby
# bad
Gem::Specification.new do |s|
  s.add_runtime_dependency 'gem_a'
end

# good
Gem::Specification.new do |s|
  s.add_dependency 'gem_a'
end
```
koic added a commit to koic/rubocop that referenced this pull request Jul 5, 2024
Follow up rubygems/rubygems#7799 (comment).

Prefer `add_dependency` over `add_runtime_dependency` because
`add_runtime_dependency` is considered soft-deprecated.

```ruby
# bad
Gem::Specification.new do |spec|
  spec.add_runtime_dependency('rubocop')
end

# good
Gem::Specification.new do |spec|
  spec.add_dependency('rubocop')
end
```

rubocop/ruby-style-guide#943 has been opened for the Style Guide.
koic added a commit to koic/rubocop that referenced this pull request Jul 5, 2024
Follow up rubygems/rubygems#7799 (comment).

Prefer `add_dependency` over `add_runtime_dependency` because
`add_runtime_dependency` is considered soft-deprecated.

```ruby
# bad
Gem::Specification.new do |spec|
  spec.add_runtime_dependency('rubocop')
end

# good
Gem::Specification.new do |spec|
  spec.add_dependency('rubocop')
end
```

rubocop/ruby-style-guide#943 has been opened for the Style Guide.
@bbatsov bbatsov merged commit 79ad25a into rubocop:master Jul 6, 2024
3 checks passed
@koic koic deleted the add_add_dependency_va_add_runtime_dependency_rule branch July 6, 2024 05:34
koic added a commit to koic/rubocop that referenced this pull request Jul 6, 2024
Follow up rubygems/rubygems#7799 (comment).

Prefer `add_dependency` over `add_runtime_dependency` as the latter is considered soft-deprecated.

```ruby
# bad
Gem::Specification.new do |spec|
  spec.add_runtime_dependency('rubocop')
end

# good
Gem::Specification.new do |spec|
  spec.add_dependency('rubocop')
end
```

rubocop/ruby-style-guide#943 has been opened for the Style Guide.
bbatsov pushed a commit to rubocop/rubocop that referenced this pull request Jul 6, 2024
Follow up rubygems/rubygems#7799 (comment).

Prefer `add_dependency` over `add_runtime_dependency` as the latter is considered soft-deprecated.

```ruby
# bad
Gem::Specification.new do |spec|
  spec.add_runtime_dependency('rubocop')
end

# good
Gem::Specification.new do |spec|
  spec.add_dependency('rubocop')
end
```

rubocop/ruby-style-guide#943 has been opened for the Style Guide.
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.

None yet

2 participants