-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Allow by
as method parameter in default config
#5734
Allow by
as method parameter in default config
#5734
Conversation
CHANGELOG.md
Outdated
@@ -6,6 +6,10 @@ | |||
|
|||
* [#5561](https://github.com/bbatsov/rubocop/issues/5561): Fix `Lint/ShadowedArgument` false positive with shorthand assignments. ([@akhramov][]) | |||
|
|||
### Changes | |||
|
|||
* [#5734](https://github.com/bbatsov/rubocop/pull/5734): Change `Naming/UncommunicativeMethodParamName` add `by` to allowed names in default config. ([@AlexWayfer][]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to write to add
or something like this. Reads a bit odd right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copied from #5626, sorry. Changed.
Add `by` to AllowedNames in default configuration for cop Naming/UncommunicativeMethodParamName in order to allow common methods handling authorship with parameter `update(values, by: user)`
41e040f
to
ada54f1
Compare
Reiterating my comment:
😉 |
Reiterating comment by @unused:
|
There's a real world example in this PR. 🙂 update(values, by: user) Doesn't take much searching to come up with other examples from popular libraries, e.g.: validate(method, on: action) validates(:inclusion, in: collection) mount(app, at: route) |
OK, thank you! Added in the new commit. |
Add `on`, `it` and `at` to AllowedNames in default configuration for cop Naming/UncommunicativeMethodParamName in order to allow common methods handling: * action with parameter `validate(method, on: action)` * collection with parameter `validates(:inclusion, in: collection)` * end-point with parameter `mount(app, at: route)`
53a3d87
to
325cb7b
Compare
@@ -769,6 +769,10 @@ Naming/UncommunicativeMethodParamName: | |||
- io | |||
- id | |||
- to | |||
- by | |||
- 'on' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because without them it's Boolean (true
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of Psych. on
, off
, yes
, no
, y
and n
are all converted too boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Drenmi Firstly, it's part of YAML standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow I never noticed this. Now I'm enlightened. 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bbatsov I forgot about this, but tests failed without quoting. 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consider quoting all of them. Consistency is nice, and it'll prevent this question from recurring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikegee Yes, maybe you're right. I thought about this, but didn't dare.
Add
by
to AllowedNames in default configuration for copNaming/UncommunicativeMethodParamName in order to allow common
methods handling authorship with parameter
update(values, by: user)
Replace this text with a summary of the changes in your PR.
The more detailed you are, the better.
Before submitting the PR make sure the following are checked:
[Fix #issue-number]
(if the related issue exists).master
(if not - rebase it).and description in grammatically correct, complete sentences.
rake default
orrake parallel
. It executes all tests and RuboCop for itself, and generates the documentation.