-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Change command for the rake task with arguments to a style that can also be used in zsh #10695
Conversation
Hm, I wonder whether this makes sense because it depends on the user's shell and its settings. The effects other than zsh are unknown, and it is an unnecessary escape if zsh also uses |
It certainly depends on the user's shell and its settings, but there are cases where it doesn't work, so it seems like there should be a good expression that works reasonably well in any environment. (would a better expression than this escape look good?) Another way to make it readable in zsh is to put it in quotation marks: ❯ bundle exec rake new_cop
usage: bundle exec rake 'new_cop[Department/Name]' |
I'm not sure what happens to the developers of bash, fish, and others. |
Certainly, I should have checked if it works in other shells. Sorry. > fish -v
fish, version 3.4.1
> bundle exec rake 'new_cop[Department/Name]'
[create] lib/rubocop/cop/department/name.rb
[create] spec/rubocop/cop/department/name_spec.rb
[modify] lib/rubocop.rb - `require_relative 'rubocop/cop/department/name'` was injected.
[modify] A configuration for the cop is added into config/default.yml.
Do 4 steps:
1. Modify the description of Department/Name in config/default.yml
2. Implement your new cop in the generated file!
3. Commit your new cop with a message such as
e.g. "Add new `Department/Name` cop"
4. Run `bundle exec rake changelog:new` to generate a changelog entry
for your new cop.
> git add -N .
> git diff --name-only
config/default.yml
lib/rubocop.rb
lib/rubocop/cop/department/name.rb
spec/rubocop/cop/department/name_spec.rb $ bash --version
bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
$ bundle exec rake 'new_cop[Department/Name]'
bundle exec rake 'new_cop[Department/Name]'
rake new_cop: lib/rubocop/cop/department/name.rb already exists!
bash-3.2$ bundle exec rake 'new_cop[Department/Name]'
bundle exec rake 'new_cop[Department/Name]'
[create] lib/rubocop/cop/department/name.rb
[create] spec/rubocop/cop/department/name_spec.rb
[modify] lib/rubocop.rb - `require_relative 'rubocop/cop/department/name'` was injected.
[modify] A configuration for the cop is added into config/default.yml.
Do 4 steps:
1. Modify the description of Department/Name in config/default.yml
2. Implement your new cop in the generated file!
3. Commit your new cop with a message such as
e.g. "Add new `Department/Name` cop"
4. Run `bundle exec rake changelog:new` to generate a changelog entry
for your new cop.
$ git add -N .
$ git diff --name-only
config/default.yml
lib/rubocop.rb
lib/rubocop/cop/department/name.rb
spec/rubocop/cop/department/name_spec.rb |
I've just found the documentation. Let's use it in single quotes. |
…lso be used in zsh
0e84d64
to
def56cb
Compare
Thanks! |
@koic Thank you for your review and checked the documents! |
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
…lso be used in zsh Follow up: rubocop/rubocop#10695
If you try to add a new cop and use the wrong command in the rake task, you will get the following warning.
If you try to execute it as is, you will face the following error.
#10695 (comment)
As noted in the documentation, it should be in a format that can be executed by zsh by enclosing it in single quotation marks.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).bundle exec rake default
. It executes all tests and runs RuboCop on its own code.{change_type}_{change_description}.md
if the new code introduces user-observable changes. See changelog entry format for details.