-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
Expected behavior
It should not detect any problem, because this is not a condition in the sense of an if/unless.
Actual behavior
Describe here what actually happened.
Offenses:
lib/blacklight.rb:32:48: W: Lint/LiteralAsCondition: Literal 'solr' appeared as a condition.
case connection_config&.fetch(:adapter) || 'solr'
Steps to reproduce the problem
Error occurs on first line.
case connection_config&.fetch(:adapter) || 'solr'
when 'solr'
Blacklight::Solr::Repository
when /::/
connection_config[:adapter].constantize
else
raise "The value for :adapter was not found in the blacklight.yml config" unless connection_config.key? :adapter
Blacklight.const_get("#{connection_config.fetch(:adapter)}/Repository".classify)
endRuboCop version
bundle exec rubocop -V
1.76.2 (using Parser 3.3.8.0, rubocop-ast 1.45.1, analyzing as Ruby 3.2, running on ruby 3.4.1) [arm64-darwin24]
- rubocop-capybara 2.22.1
- rubocop-rspec 3.6.0
- rubocop-rspec_rails 2.31.0
- rubocop-rails 2.32.0
- rubocop-factory_bot 2.27.1