73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
# .rubocop.yml
|
|
require:
|
|
- rubocop-performance # For performance-related cops
|
|
- rubocop-minitest
|
|
- rubocop-rspec
|
|
|
|
AllCops:
|
|
TargetRubyVersion: 3.4.4
|
|
Exclude:
|
|
- 'vendor/**/*'
|
|
- 'tmp/**/*'
|
|
- 'log/**/*'
|
|
- 'Gemfile.lock'
|
|
- 'Containerfile' # Not a Ruby file
|
|
- 'responses.yml' # Not a Ruby file
|
|
- 'README.md' # Not a Ruby file
|
|
|
|
# Style and Layout Cops
|
|
Layout/LineLength:
|
|
Max: 120 # A bit more lenient than default 80, but enforce a limit
|
|
Exclude:
|
|
- 'Rakefile' # Rake tasks can sometimes have long lines
|
|
|
|
Metrics/BlockLength:
|
|
# Allows longer blocks for RSpec and Minitest spec files
|
|
# Adjust as needed for your test framework
|
|
Exclude:
|
|
- '**/*_spec.rb'
|
|
- '**/*_test.rb'
|
|
# For non-test files, a reasonable limit
|
|
Max: 50
|
|
|
|
Metrics/AbcSize:
|
|
Max: 20 # Adjust if methods are consistently complex
|
|
|
|
Metrics/MethodLength:
|
|
Max: 15 # Keep methods concise
|
|
|
|
Style/Documentation:
|
|
Enabled: false # Disable documentation comments for simple apps
|
|
|
|
Style/FrozenStringLiteralComment:
|
|
Enabled: true # Good practice for Ruby 2.3+
|
|
|
|
Style/ClassAndModuleChildren:
|
|
Enabled: false # Allows MyApp::MyClass instead of MyApp::MyClass
|
|
|
|
Style/StringLiterals:
|
|
EnforcedStyle: single_quotes # Prefer single quotes unless interpolation is needed
|
|
|
|
Style/StringLiteralsInInterpolation:
|
|
EnforcedStyle: single_quotes # Prefer single quotes even within interpolation
|
|
|
|
Style/WordArray:
|
|
MinSize: 3 # Use %w[] for arrays of strings longer than this
|
|
|
|
Style/HashEachMethods:
|
|
Enabled: true # Prefer #each_key, #each_value, #each_pair over #each
|
|
|
|
Style/CaseEquality:
|
|
Enabled: false # Often used in Sinatra routes, e.g. when matched against paths
|
|
|
|
# Naming Cops
|
|
Naming/FileName:
|
|
Exclude:
|
|
- 'app.rb' # Allow for `app.rb` which is common for Sinatra entry points
|
|
|
|
# Performance Cops (from rubocop-performance)
|
|
Performance/CompareWithBlock:
|
|
Enabled: true
|
|
|
|
Performance/StringIdentifierArgument:
|
|
Enabled: true
|