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
56 changes: 56 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Claude Code Review

on:
pull_request:
types: [opened, synchronize]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"

jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'

runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.pull_request.number }}

Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.

Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.

# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'
49 changes: 49 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}

# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read

# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'

# Optional: Add claude_args to customize behavior and configuration
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests

on:
pull_request:
paths-ignore:
- "*.md"
- "LICENSE.txt"
push:
branches:
- main
paths-ignore:
- "*.md"
- "LICENSE.txt"

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
ruby_version: ["3.3", "3.4", "4.0"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby_version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler-cache: true

- name: Run tests
run: bundle exec rake test

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-ruby-${{ matrix.ruby_version }}
path: test/reports/
retention-days: 7
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
/doc/
/pkg/
/spec/reports/
/test/reports/
/tmp/

.cursor
.claude

/dist/
199 changes: 199 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# frozen_string_literal: true

plugins:
- rubocop-minitest
- rubocop-performance

AllCops:
TargetRubyVersion: 3.1
NewCops: enable
SuggestExtensions: false
Exclude:
- 'bin/**/*'
- 'examples/**/*'
- 'coverage/**/*'
- 'pkg/**/*'
- 'test/**/*'
- 'vendor/**/*'
- 'test/dummy/**/*'
- 'db/migrate/**/*' # Generated migrations
- 'lib/generators/**/templates/**/*' # Generator templates

# Layout & Formatting
Layout/LineLength:
Max: 120
AllowedPatterns:
- '\s*#.*' # Allow long comments
- '^\s*raise\s' # Allow long raise statements

Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented

Layout/ArgumentAlignment:
EnforcedStyle: with_first_argument

Layout/FirstArgumentIndentation:
EnforcedStyle: consistent

# Style
Style/Documentation:
Enabled: false # Don't require class documentation for now

Style/StringLiterals:
EnforcedStyle: double_quotes

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always

Style/ClassAndModuleChildren:
EnforcedStyle: nested

Style/GuardClause:
MinBodyLength: 3

# Metrics
Metrics/ClassLength:
Max: 220

Metrics/ModuleLength:
Max: 260

Metrics/MethodLength:
Max: 40
AllowedMethods:
- 'configure' # Configuration blocks can be longer

Metrics/BlockLength:
Max: 40
AllowedMethods:
- 'configure'
- 'describe'
- 'context'
- 'it'
- 'test'
Exclude:
- 'test/**/*' # Allow long test blocks
- 'goodmail.gemspec'

Metrics/AbcSize:
Max: 50
AllowedMethods:
- 'configure'

Metrics/CyclomaticComplexity:
Max: 10

Metrics/PerceivedComplexity:
Max: 10

Metrics/ParameterLists:
Max: 6

# Naming
Naming/PredicatePrefix:
ForbiddenPrefixes:
- 'is_'
AllowedMethods:
- 'is_a?'

Naming/MethodParameterName:
MinNameLength: 1

Naming/BlockForwarding:
Enabled: false

# Performance
Performance/StringReplacement:
Enabled: true

Performance/RedundantMerge:
Enabled: true

# Minitest
Minitest/MultipleAssertions:
Enabled: false # Allow multiple assertions in integration tests

Minitest/AssertTruthy:
Enabled: false # Allow assert instead of assert_equal true

# Custom overrides for this gem
Style/AccessorGrouping:
Enabled: false # Allow separate attr_reader/attr_writer

Style/MutableConstant:
Enabled: false # We have some intentionally mutable constants

Style/Alias:
Enabled: false

Style/ArgumentsForwarding:
Enabled: false

Style/ConditionalAssignment:
Enabled: false

Style/IfUnlessModifier:
Enabled: false

Style/ModuleFunction:
Enabled: false

Style/OpenStructUse:
Enabled: false

Style/PercentLiteralDelimiters:
Enabled: false

Style/RedundantRegexpArgument:
Enabled: false

Style/RegexpLiteral:
Enabled: false

Style/RescueStandardError:
Enabled: false

Style/StringLiteralsInInterpolation:
Enabled: false

Style/Next:
Enabled: false

# Allow class variables for registry pattern
Style/ClassVars:
Enabled: false

# Allow metaprogramming patterns common in Rails engines
Style/EvalWithLocation:
Enabled: false

Lint/MissingSuper:
Enabled: false # Allow classes that don't call super

# Disable some cops that don't work well with our DSL
Style/MethodCallWithoutArgsParentheses:
Enabled: false # Our DSL looks better without parens

Layout/EmptyLineAfterMagicComment:
Enabled: false

Layout/EmptyLinesAfterModuleInclusion:
Enabled: false

Layout/HashAlignment:
Enabled: false

Layout/CommentIndentation:
Enabled: false

Lint/UselessConstantScoping:
Enabled: false

# Thread safety
Style/GlobalVars:
AllowedVariables: ['$0'] # Only allow program name

# Database-related
Style/NumericLiterals:
Enabled: false # Allow raw numbers in database IDs/amounts
Loading
Loading