rubocop-rails
rubocop-rails copied to clipboard
Add new config `arguments_or_slashes` to `Rails/FilePath`
Config to just check for usage of File.path
, but doesn't care about arguments to Rails.root.join
Before submitting the PR make sure the following are checked:
- [x] Wrote good commit messages.
- [ ] Commit message starts with
[Fix #issue-number]
(if the related issue exists). - [x] Feature branch is up-to-date with
master
(if not - rebase it). - [x] Squashed related commits together.
- [x] Added tests.
- [x] Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
- [ ] If this is a new cop, consider making a corresponding update to the Rails Style Guide.
- [x] The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
- [x] Run
bundle exec rake default
. It executes all tests and RuboCop for itself, and generates the documentation.
I think the concept is good 👍 However I doubt the addition of the new parameter EnforcedStyle: arguments_or_slashes
. I think this cop should probably be updated to accept multiple EnforcedStyle
configuration using AllowMultipleStyles: true
.
# .rubocop.yml
Rails/FilePath:
EnforcedStyle:
- slashes
- arguments
Refer: https://github.com/rubocop-hq/rubocop/pull/6649
@koic Looks like rubocop does not support multiple styles for EnforcedStyle
yet - CI error.
Yup. About implementation should investigate the cause of the error and resolve it. I haven't reached the cause yet. AllowMultipleStyles
provides new representation option for user, but it is a relatively new parameter and needs to be grown when something is missing.