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

Specify TargetRubyVersion: 2.7 in .rubocop.yml #1544

Conversation

koic
Copy link
Contributor

@koic koic commented Feb 14, 2023

Behavior

Before the change?

Version mismatch between required_ruby_version of gemspec and TargetRubyVersion of .rubocop.yml. Therefore, some new syntax up to Ruby 2.7 is not used.

After the change?

gemspec required_ruby_version requires 2.7 and higher, so specify TargetRubyVersion to 2.7. Some syntax detected by updating to 2.7 applies.

It also removes Gemspec/RequiredRubyVersion cop from .rubocop_todo.yml to enable the cop so that version mismatch can be detected.

Other information

This PR is follow up #1454.


Additional info

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

Please add the corresponding label for change this PR introduces:

  • Bugfix: Type: Bug
  • Feature/model/API additions: Type: Feature
  • Updates to docs or samples: Type: Documentation
  • Dependencies/code cleanup: Type: Maintenance

Follow up octokit#1454.

gemspec `required_ruby_version` requires 2.7 and higher, so specify
`TargetRubyVersion` to 2.7. Some syntax detected by updating to 2.7 applies.

It also removes `Gemspec/RequiredRubyVersion` cop from .rubocop_todo.yml to
enable the cop so that version mismatch can be detected.
Copy link
Member

@kfcampbell kfcampbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a quick question about some of the syntax for my own knowledge but this looks great. Thanks!

@@ -163,10 +163,10 @@ def inspect
inspected.gsub! @bearer_token, '********' if @bearer_token
# Only show last 4 of token, secret
if @access_token
inspected.gsub! @access_token, "#{'*' * 36}#{@access_token[36..-1]}"
inspected.gsub! @access_token, "#{'*' * 36}#{@access_token[36..]}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind explaining this change to me? Were we only showing the first, second, and third from last characters in the token?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String#[s..-1] and String#[s..] are compatible with the endless range syntax added in Ruby 2.6.

@kfcampbell kfcampbell merged commit d48eaff into octokit:main Feb 27, 2023
@koic koic deleted the specify_target_ruby_version_2_7_in_dot_rubocop_yml branch February 27, 2023 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants