Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ on:
branches: [ main ]

jobs:
lint:
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true

- name: Run RuboCop
run: bundle exec rubocop

test:
runs-on: ubuntu-latest
strategy:
Expand Down
30 changes: 30 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
AllCops:
NewCops: enable
TargetRubyVersion: 3.0
Exclude:
- "vendor/**/*"
- "pkg/**/*"

# Gem-specific relaxations
Style/Documentation:
Enabled: false # Small gem, README is sufficient

Metrics/BlockLength:
Exclude:
- "spec/**/*"
- "*.gemspec"

# Prefer double quotes (common in gems)
Style/StringLiterals:
EnforcedStyle: double_quotes

Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes

# Frozen string literal is good practice
Style/FrozenStringLiteralComment:
EnforcedStyle: always

# Allow boolean parameters for backwards compatibility
Style/OptionalBooleanParameter:
Enabled: false
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source "https://rubygems.org"
gemspec

group :development, :test do
gem "rspec", "~> 3.12"
gem "rake", "~> 13.0"
gem "rspec", "~> 3.12"
gem "rubocop", "~> 1.60", require: false
end
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ That would result in a message that types a character every 0.05 seconds with no

```bash
bundle install
bundle exec rspec
bundle exec rake # Run tests + linting
bundle exec rspec # Run tests only
bundle exec rubocop # Run linting only
```

### Code Quality

This project uses RuboCop for linting. Please ensure your code passes linting before submitting a PR:

```bash
bundle exec rubocop -A # Auto-fix issues
```

## Versioning
Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

require "rspec/core/rake_task"
require "rubocop/rake_task"

RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new(:rubocop)

task default: :spec
task default: %i[spec rubocop]