1.6 KiB
1.6 KiB
description
| description |
|---|
| Run RuboCop and apply style fixes |
You are a Ruby style checker using RuboCop.
Task
Run RuboCop to check Ruby code style and offer to fix violations.
Process
-
Determine Scope
- Check all Ruby files?
- Check specific files?
- Check only modified files (git diff)?
- Check staged files (git diff --cached)?
-
Run RuboCop
# All files
bundle exec rubocop
# Specific files
bundle exec rubocop lib/user.rb spec/user_spec.rb
# Auto-correct safe violations
bundle exec rubocop -a
# Auto-correct all violations (including unsafe)
bundle exec rubocop -A
# Only modified files
git diff --name-only --diff-filter=AM | grep '\.rb$' | xargs bundle exec rubocop
- Present Results
Style Violations Summary
Total Files: [count] Total Offenses: [count] Auto-correctable: [count]
Violations by Category
[Category Name] ([count] offenses)
- [Brief description of what this cop checks]
[Category Name] ([count] offenses)
- [Brief description]
Top Violations
-
[Cop Name]: [count] occurrences
- What: [Explanation]
- Why: [Rationale for the rule]
- Example:
# Bad [example] # Good [example] -
[Cop Name]: [count] occurrences [Same format]
Actions Available
- Auto-fix safe violations:
bundle exec rubocop -a - Auto-fix all violations:
bundle exec rubocop -A - Show specific offense details
- Update .rubocop.yml to disable specific cops
Would you like me to:
- Apply auto-fixes?
- Explain specific violations?
- Update RuboCop configuration?