Use consistent ivar memoization naming style (LG-4866)#5761
Merged
zachmargolis merged 1 commit intomainfrom Dec 29, 2021
Merged
Use consistent ivar memoization naming style (LG-4866)#5761zachmargolis merged 1 commit intomainfrom
zachmargolis merged 1 commit intomainfrom
Conversation
- Enforce it with rubocop
zachmargolis
commented
Dec 28, 2021
Comment on lines
194
to
196
| def transform(algorithm) | ||
| @_transform ||= transforms_nodeset[0].xpath( | ||
| transforms_nodeset[0].xpath( | ||
| "//ds:Transform[@Algorithm='#{algorithm}']", |
Contributor
Author
There was a problem hiding this comment.
Since there's an algorithm argument that changes the result, I decided it was safer not to memoize this one at all
zachmargolis
commented
Dec 28, 2021
|
|
||
| # rubocop:disable Naming/MemoizedInstanceVariableName | ||
| def entry_for_current_phone | ||
| @entry ||= OtpRequestsTracker.find_or_create_with_phone_and_confirmed(phone, phone_confirmed) |
Contributor
Author
There was a problem hiding this comment.
I could have renamed the ivar in #increment too but this seemed easier to leave as-is
| end | ||
|
|
||
| def piv_cac_verfication_form | ||
| def piv_cac_verification_form |
mitchellhenke
approved these changes
Dec 29, 2021
zachmargolis
commented
Dec 29, 2021
|
|
||
| def set_idv_form | ||
| @idv_form ||= Idv::PhoneForm.new( | ||
| @idv_form = Idv::PhoneForm.new( |
Contributor
Author
There was a problem hiding this comment.
Removed memoization because this is a before filter, so it's always called
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ticket was just about the ivar names themselves, but the rubocop cop helps check that they match the method name too, which seemed worthwhile including
To pick between
@variableand@_variable, I counted usages of each:so
@variablewas more prevalent, so I kept it