Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
Comment thread
justin808 marked this conversation as resolved.

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pinning to 3.0.6 (an older, EOL Ruby version) in a new workflow is a missed opportunity.

Ruby 3.0 reached end-of-life in March 2024. Lint failures on modern Ruby (3.3/3.4) may silently go undetected. Consider using the same version strategy as your test matrix, or at least a supported Ruby like 3.3 or 3.4:

Suggested change
with:
ruby-version: '3.4'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The lint workflow uses 3.0.6 to match the gem's minimum supported version (required_ruby_version >= 3.0.0). Upgrading the minimum Ruby version and testing across a matrix would be a separate discussion/PR. This PR focuses on adding linting infrastructure.

ruby-version: '3.0.6'
Comment thread
justin808 marked this conversation as resolved.
Outdated
bundler-cache: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Run RuboCop
run: bundle exec rubocop

- name: Check for files missing newlines
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ruby 3.0 reached end-of-life in March 2024 and no longer receives security fixes. Consider using a supported version here (and in ruby.yml which was just bumped to the same EOL version):

Suggested change
- name: Check for files missing newlines
ruby-version: '3.3'

Using a minor version without a patch (e.g. '3.3') lets ruby/setup-ruby pick the latest patch release automatically, reducing maintenance overhead.

run: bundle exec rake check_newlines
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.6
ruby-version: 3.0.6
bundler-cache: true
- name: Run tests
run: bundle exec rake
Expand Down
64 changes: 64 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-rake
- rubocop-rspec

AllCops:
TargetRubyVersion: 3.0
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

NewCops: enable means every RuboCop patch version upgrade can introduce new failing cops that block CI without any opt-in decision. This is somewhat at odds with the todo-list approach in this PR — the todo list was generated to silence existing violations, but new cops added in future RuboCop releases will fire immediately on new code.

Consider NewCops: pending (the RuboCop default), which prints a warning about new cops without failing the run, letting you consciously opt each one in:

Suggested change
TargetRubyVersion: 3.0
NewCops: pending

NewCops: enable
Exclude:
- 'vendor/**/*'
- 'spec/fixtures/**/*'
- 'tmp/**/*'
- 'pkg/**/*'
- 'node_modules/**/*'
- 'specs_e2e/**/*'
- 'e2e/**/*'

# Ensure all files end with a newline
Layout/TrailingEmptyLines:
Enabled: true
EnforcedStyle: final_newline

# Ensure no trailing whitespace
Layout/TrailingWhitespace:
Enabled: true

# Line length is configured in .rubocop_todo.yml for existing violations

# Allow longer blocks in specs and rake tasks
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- '**/*.rake'
- 'Rakefile'
- '*.gemspec'

# Allow longer methods in rake tasks
Metrics/MethodLength:
Exclude:
- '**/*.rake'
- 'Rakefile'

# String literals - configured in .rubocop_todo.yml for gradual adoption

# Frozen string literal pragma - configured in .rubocop_todo.yml for gradual adoption

# Documentation
Style/Documentation:
Enabled: false

# Allow compact module/class definitions
Style/ClassAndModuleChildren:
Enabled: false

# RSpec specific
RSpec/ExampleLength:
Max: 20

RSpec/MultipleExpectations:
Max: 5

RSpec/NestedGroups:
Max: 4
Loading