Skip to content
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

Prefer keyword arguments when method has optional boolean arguments #2955

Merged
merged 2 commits into from Nov 13, 2020

Conversation

gravitystorm
Copy link
Collaborator

This PR fixes some cases where we are using optional boolean parameters, to use keyword arguments instead.

I think this is particularly useful where the method definition lies elsewhere, since it's not obvious what an isolated 'true' or 'false' means.

https://docs.rubocop.org/rubocop/1.0/cops_style.html#styleoptionalbooleanparameter

@tomhughes
Copy link
Member

Looks like you missed something:

Error:
DiaryEntryTest#test_diary_entry_validations:
ArgumentError: wrong number of arguments (given 2, expected 1)
    test/models/diary_entry_test.rb:51:in `diary_entry_valid'
    test/models/diary_entry_test.rb:13:in `test_diary_entry_validations'


rails test test/models/diary_entry_test.rb:9

@tomhughes
Copy link
Member

Maybe that test failure wasn't down to this as travis has passed and I've just seen that failure in a checkout without this merged.... Guess there me some non-deterministic failure :-(

@tomhughes
Copy link
Member

No it is from this branch - my checkout was messed up.

@tomhughes
Copy link
Member

Ah and you had fixed it anyway.

@tomhughes tomhughes merged commit 6322171 into openstreetmap:master Nov 13, 2020
@gravitystorm
Copy link
Collaborator Author

Ah and you had fixed it anyway.

Sorry! I force-pushed, and then I was waiting to double-check that travis passed before commenting, but I got distracted and forgot to come back.

@gravitystorm gravitystorm deleted the boolean_parameters branch November 25, 2020 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants