---
title: Dangerous methods should end with !
impact: MEDIUM
impactDescription: Clearly indicate methods that modify the receiver or can raise exceptions.
tags: ruby, naming, bang, side-effect
---

## Dangerous methods should end with !

Clearly indicate methods that modify the receiver or can raise exceptions. Methods that modify the object in place or can raise exceptions should end with a bang (`!`).

**Incorrect:**

```ruby
# Method raises an exception if validation fails
def save
  # complex logic
end

# In-place sort
values.sort
```

**Correct:**

```ruby
# Recommends save! for raising exceptions
def save!
  # complex logic
end

# Indicates in-place sort
values.sort!
```

**Tools:** RuboCop (`Style/BangPredicate`)
