chore: add rubocop pre-commit hook and fix all offenses#76
Merged
Conversation
- Add rubocop v1.86.2 to .pre-commit-config.yaml (language_version: 3.4.7 to match pre-commit's bundled ruby-build) - Add .rubocop.yml with NewCops enabled; exclude spec/ from Metrics cops and disable Naming/FileName (Dockerfile_spec.rb names are intentional) - Add .ruby-version (3.4.9) for local rbenv - Fix all rubocop offenses: string literals, hash syntax, ENV.fetch, redundant string escapes, slicing with range, and more Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
.pre-commit-config.yamlwithlanguage_version: 3.4.7(highest version in pre-commit's bundled ruby-build).rubocop.yml— enables new cops, suppresses extension suggestions, excludesspec/from Metrics cops, and disablesNaming/FileNamesinceDockerfile_spec.rbnames are intentional.ruby-version(3.4.9) for local rbenvkey:vs:key =>)ENV['TARGET_HOST']→ENV.fetch('TARGET_HOST', nil)target[1..-1]→target[1..]in Rakefile"#{tag}"→tag.to_sin Dockerfile specsNotes
language: rubyhook uses its own isolated rbenv — it doesn't share with the system rbenv. Thelanguage_version: 3.4.7tells pre-commit which Ruby to build for the hook environment;.ruby-version: 3.4.9is for local project use via rbenv.Test plan
pre-commit run --all-filespasses locally (requires rbenv + Ruby 3.4.x)🤖 Generated with Claude Code