-
Notifications
You must be signed in to change notification settings - Fork 13
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
Drop support for Ruby 2.3 and older #31
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -103,7 +103,7 @@ def fix(problem) | |||||
problem[:token].prev_code_token.prev_token.value = ' ' * problem[:newline_indent] | ||||||
|
||||||
end_param_idx = tokens.index(problem[:token].prev_code_token) | ||||||
start_param_idx = tokens.index(problem[:token].prev_token_of([:INDENT, :NEWLINE])) | ||||||
start_param_idx = tokens.index(problem[:token].prev_token_of(%i[INDENT NEWLINE])) | ||||||
param_length = tokens[start_param_idx..end_param_idx].map { |r| r.to_manifest.length }.reduce(0) { |sum, x| sum + x } + 1 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is completely unrelated, but I'm just looking at this and this is a bit hard to read. I really wonder if this isn't the same as:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks ok to me, but I don't know enough about ruby to ensure this works. could be handled with a test. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked and |
||||||
new_ws_len = problem[:arrow_column] - param_length | ||||||
else | ||||||
|
@@ -115,7 +115,7 @@ def fix(problem) | |||||
new_ws_len += (problem[:arrow_column] - problem[:token].column) | ||||||
end | ||||||
|
||||||
raise PuppetLint::NoFix if new_ws_len < 0 | ||||||
raise PuppetLint::NoFix if new_ws_len.negative? | ||||||
new_ws = ' ' * new_ws_len | ||||||
|
||||||
if problem[:token].prev_token.type == :WHITESPACE | ||||||
|
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 thought the safe navigator was Ruby 2.5. Am I messing up versions in my head?
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 did the safe autofix with ruby 2.4 as target version