Skip to content

Conversation

@sambostock
Copy link

Summary

This PR adds a new RuboCop cop called AssignmentRules that allows teams to enforce that all smart TODOs include specific required assignees. This helps centralize TODO notifications and ensures important TODOs don't get missed.

Motivation

Teams often want to ensure that critical TODOs are visible to specific channels or stakeholders. For example, a team might want all smart TODOs to be assigned to their project channel so they can track and review them in one place.

How it works

The cop checks that all "smart" TODOs (those with events and assignees) include all required assignees specified in the configuration.

Configuration

SmartTodo/AssignmentRules:
  RequiredAssignees:
    - '#project-alerts'
    - '@team-lead'

Example

# Bad - missing required assignees
# TODO(on: date('2024-03-29'), to: 'john@example.com')
#   Fix this issue

# Good - includes all required assignees
# TODO(on: date('2024-03-29'), to: 'john@example.com', to: '#project-alerts', to: '@team-lead')
#   Fix this issue

Features

  • Supports multiple required assignees
  • Only applies to smart TODOs (regular TODOs are unaffected)
  • Works with all TODO tags: TODO, FIXME, OPTIMIZE
  • Clear, actionable error messages
  • Comprehensive test coverage (29 test cases)

Future extensibility

The AssignmentRules name was chosen to allow for future extensions such as:

  • Minimum assignee count
  • Forbidden assignees
  • Pattern-based requirements
  • Conditional rules based on event type

Test plan

  • All new tests pass (29 test cases covering various scenarios)
  • Full test suite passes (236 tests total)
  • Cop follows existing patterns and conventions
  • Documentation is clear and comprehensive

🤖 Generated with Claude Code

sambostock and others added 2 commits January 13, 2026 19:59
This cop allows teams to enforce that all smart TODOs include specific
required assignees (such as team channels or key stakeholders). This helps
centralize TODO notifications and ensures important TODOs don't get missed.

The cop is configurable via .rubocop.yml:

  SmartTodo/AssignmentRules:
    RequiredAssignees:
      - '#project-alerts'
      - '@team-lead'

The cop only applies to "smart" TODOs (those with events and assignees),
and checks that all required assignees are present in the TODO's assignee
list.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@Edouard-chin
Copy link
Member

Thank for this feature !

Teams often want to ensure that critical TODOs

With this new cop enabled, does this mean every TODO will need to be assigned to the right persons/slack channel ? Wouldn't this make all TODOs seem "critical" now ?

What do you think about letting developers mark the TODO as critical (inferring the importance of a TODO with tooling is going to be very hard, so maybe its best to let humans decide), and when SmartTodo detects a critical TODO it sends a notification to a channel you have configured ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants