rubocop
Skill107 starsChanged 9 months agoMITView on GitHub
Run RuboCop linting and fix offenses for the redmine_ai_helper plugin
In this repository48 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- commitSkill
- create-pull-requestSkill
- create-release-branchSkill
- create-release-notesSkill
- handle-pr-reviewSkill
- qlty-checkSkill
- record-code-review-feedbackSkill
- record-spec-feedbackSkill
- recreate-test-dbSkill
- redmine-playwright-loginSkill
- regression-checkSkill
- speckit-agent-context-updateSkill
- speckit-analyzeSkill
- speckit-branch-convention-configureSkill
- speckit-branch-convention-renameSkill
- speckit-branch-convention-validateSkill
- speckit-checklistSkill
- speckit-clarifySkill
- speckit-constitutionSkill
- speckit-convergeSkill
- speckit-git-commitSkill
- speckit-git-featureSkill
- speckit-git-initializeSkill
- speckit-git-remoteSkill
- speckit-git-validateSkill
- speckit-implementSkill
- speckit-planSkill
- speckit-review-codeSkill
- speckit-review-commentsSkill
- speckit-review-errorsSkill
- speckit-review-runSkill
- speckit-review-simplifySkill
- speckit-review-testsSkill
- speckit-review-typesSkill
- speckit-specifySkill
- speckit-tasksSkill
- speckit-taskstoissuesSkill
- speckit-token-budget-compactSkill
- speckit-token-budget-conciseSkill
- speckit-token-budget-scopeSkill
- speckit-token-budget-usageSkill
- speckit-wiki-ingestSkill
- speckit-wiki-initSkill
- speckit-wiki-lintSkill
- speckit-wiki-querySkill
- speckit-wiki-statusSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Run RuboCop on the plugin codebase, auto-fix what is safe, and manually resolve remaining offenses.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
RuboCop Check and Fix
Run RuboCop on the plugin codebase, auto-fix what is safe, and manually resolve remaining offenses.
Workflow
Step 1: Run RuboCop
rubocop 2>&1Step 2: Auto-fix safe offenses
rubocop -A --except Rails/ActionControllerTestCase 2>&1Exclude Rails/ActionControllerTestCase — Redmine plugin tests require ActionController::TestCase. Converting to ActionDispatch::IntegrationTest breaks the tests helper method and other controller-specific APIs.
Step 3: Manually fix remaining offenses
Address any offenses that remain after auto-correction using the guidelines below.
IMPORTANT: Never modify
.rubocop.ymlthresholds (Max:values) orExclude:settings without explicit user approval. If offenses cannot be fixed in the source code, report them to the user and ask how to proceed. Do not raiseMax:values, add newExclude:entries, or rungit checkout -- .rubocop.ymlto work around violations.
| Cop | Action |
Rails/Pluck | If called on a plain Ruby array (not ActiveRecord), add # rubocop:disable Rails/Pluck inline |
Rails/RedundantPresenceValidationOnBelongsTo | If tests assert errors[:foreign_key_id], the explicit validation is needed — add # rubocop:disable inline |
Rails/I18nLocaleAssignment | Rewrite I18n.locale = x as an I18n.with_locale(x) { ... } block |
| Cop disabled project-wide | Add Enabled: false under the cop name in .rubocop.yml — only with user approval |
Step 4: Run tests to verify
bundle exec rake redmine:plugins:test NAME=redmine_ai_helper 2>&1 | tail -20Confirm 0 failures and 0 errors before finishing.
Common Cases
Rails/ActionControllerTestCase
Already disabled in .rubocop.yml. No changes needed.
Rails/ActionControllerTestCase:
Enabled: falseRails/RedundantPresenceValidationOnBelongsTo
The implicit belongs_to validation puts errors on :association_name, not :foreign_key_id. If tests check errors[:project_id] or errors[:user_id], keep the explicit validation:
validates :project_id, presence: true # rubocop:disable Rails/RedundantPresenceValidationOnBelongsTo
validates :user_id, presence: true # rubocop:disable Rails/RedundantPresenceValidationOnBelongsToRails/Pluck
.pluck is an ActiveRecord method and does not work on plain Ruby arrays. Disable inline:
issue_counts = members_workload.map { |m| m[:assigned_issues] } # rubocop:disable Rails/PluckRails/I18nLocaleAssignment
# Before
original_locale = I18n.locale
I18n.locale = :ja
# ... test code
ensure
I18n.locale = original_locale
# After
I18n.with_locale(:ja) do
# ... test code
endDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

