Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .agents/skills/merge-ruff-120/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: merge-ruff-120
description: "Reformat code on a feature branch and merge main cleanly after the Ruff line-length increase from 79 to 120 (merged August 7, 2026, commit 0110bb1d273dbe848312d429326b844da9e86d93, PR #5514). Relevant for branches created before August 2026."
---

# Merging main and Reformatting Code (Ruff 120 Line Length)

## Overview

In PR #5514 (merged on August 7, 2026, commit `0110bb1d273dbe848312d429326b844da9e86d93`), OpenTelemetry Python updated its Ruff configuration in `pyproject.toml` to increase `line-length` from 79 to 120 characters and reformatted the entire codebase.

Feature branches created prior to August 7, 2026 (before this commit) will encounter extensive merge conflicts if merged directly. This skill instructs an agent on how to detect this situation and perform a clean multi-step merge without formatting conflict markers.

## Detection: When to Use This Skill

An agent can test whether a branch needs this reformatting workflow:

```bash
# Returns non-zero (exit code 1) if the branch was created BEFORE the Ruff 120 change (August 7, 2026):
git merge-base --is-ancestor 0110bb1d273dbe848312d429326b844da9e86d93 HEAD
```

If the commit is **not** an ancestor of `HEAD`, follow the workflow below.

---

## Workflow

Follow these steps on the contributor's feature branch:

### Step 1: Ensure workspace is clean & sync dependencies

```bash
uv sync --frozen --all-packages
git fetch origin main
```

### Step 2: Merge the commit before the line-length change

Merge all changes up to the commit immediately *before* the Ruff 120 reformat:

```bash
git merge 0110bb1d273dbe848312d429326b844da9e86d93^
```

Because both sides are still 79-column code, there are zero formatting conflicts. Resolve any real semantic conflicts if present, then commit the merge.

### Step 3: Merge the reformatting commit with `-X ours --no-commit`

Merge the reformat commit, automatically choosing the branch's code on any formatting conflicts and pausing before creating the merge commit:

```bash
git merge -X ours --no-commit 0110bb1d273dbe848312d429326b844da9e86d93
```

### Step 4: Format and lint the branch to 120 columns

Ensure `pyproject.toml` has `line-length = 120` and run Ruff directly to format and lint the code:

```bash
sed -i 's/line-length = 79/line-length = 120/' pyproject.toml
uv run ruff format
uv run ruff check --fix
```

### Step 5: Finalize the merge commit

```bash
git commit -am "chore: merge Ruff 120 reformat and format branch"
```

### Step 6: Catch up with latest `main`

```bash
git merge origin/main
```
Loading