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
Maybe Style/StringConcatenation should be conservative by default #11757
Comments
This configuration was introduced at #9153 with |
I still stand by my original opinion. That cop is next to useless with the conservative config. Likely we'll just have it disabled by default in RuboCop 2.0, as one of the main goals is to streamline the default configuration (profile) and have be more conservative in general. |
See also #10726 |
A minimal example of how this breaks filepath: # frozen_string_literal: true
require 'pathname'
FILENAME = 'mime.types'
pn = Pathname.new('/etc')
fp = pn + 'nginx' + FILENAME
puts fp # /etc/nginx/mime.types
# frozen_string_literal: true
require 'pathname'
FILENAME = 'mime.types'
pn = Pathname.new('/etc')
fp = "#{pn}nginx#{FILENAME}"
puts fp # /etcnginxmime.types |
|
as per https://docs.rubocop.org/rubocop/cops_style.html#stylestringconcatenation,
aggressive
mode is currently the default.this is not ideal because it triggers false positives and people have to research it and change the mode.
URI#+
, which returns a URI and prevents double slashesuri + '/some_path'
always returns a valid URIPathname#+
behaves similarly and thus yields similar false positives#+
are also affectedThe text was updated successfully, but these errors were encountered: