agentleFS
haruharu/redmine_ai_helper/.claude/skills/rubocop/SKILL.md

rubocop

Skill107 starsChanged 9 months agoMITView on GitHub

Run RuboCop linting and fix offenses for the redmine_ai_helper plugin

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
  1. Distinctive:

    Run RuboCop on the plugin codebase, auto-fix what is safe, and manually resolve remaining offenses.

    line 8

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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>&1

Step 2: Auto-fix safe offenses

rubocop -A --except Rails/ActionControllerTestCase 2>&1

Exclude 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.yml thresholds (Max: values) or Exclude: 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 raise Max: values, add new Exclude: entries, or run git checkout -- .rubocop.yml to work around violations.

CopAction
Rails/PluckIf called on a plain Ruby array (not ActiveRecord), add # rubocop:disable Rails/Pluck inline
Rails/RedundantPresenceValidationOnBelongsToIf tests assert errors[:foreign_key_id], the explicit validation is needed — add # rubocop:disable inline
Rails/I18nLocaleAssignmentRewrite I18n.locale = x as an I18n.with_locale(x) { ... } block
Cop disabled project-wideAdd 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 -20

Confirm 0 failures and 0 errors before finishing.

Common Cases

Rails/ActionControllerTestCase

Already disabled in .rubocop.yml. No changes needed.

Rails/ActionControllerTestCase:
  Enabled: false

Rails/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/RedundantPresenceValidationOnBelongsTo

Rails/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/Pluck

Rails/I18nLocaleAssignment

# Before
original_locale = I18n.locale
I18n.locale = :ja
# ... test code
ensure
  I18n.locale = original_locale

# After
I18n.with_locale(:ja) do
  # ... test code
end

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.