Skip to content

ci: add ruff for python linting and formatting - #26

Merged
parse merged 2 commits into
mainfrom
ci/add-ruff-linting
Mar 4, 2026
Merged

parse merged 2 commits into
mainfrom
ci/add-ruff-linting

Conversation

@parse

@parse parse commented Mar 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add ruff config (ruff.toml) targeting py313 with E/F/I/W/UP/B/SIM/RUF rules
  • Add python-check CI job using astral-sh/ruff-action@v3 for lint + format checks
  • Add lint:python, format:python, format:python:check npm scripts
  • Fix 10 ruff violations in generate_video.py (tuple unpacking, lambda loop var binding)
  • Add ruff to knip ignoreBinaries (system binary, not an npm dep)

Test plan

  • python-check CI job passes (lint + format)
  • Existing check CI job still passes

Summary by CodeRabbit

  • New Features

    • Added GIF export: generate GIFs alongside MP4s, with a CLI option to specify GIF output and support for deriving GIF path from the main output; generates frames once for both formats and ensures output directories exist.
    • Exposed encoding quality option via CLI (CRF).
  • Chores

    • Integrated Python lint/format tooling and added config.
    • Added CI steps and npm scripts for lint/format checks.

Add ruff config, CI job (astral-sh/ruff-action), and npm scripts
for lint:python / format:python. Fix existing violations in
generate_video.py.
@coderabbitai

coderabbitai Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0c2690c4-e2e1-4eaf-9010-a1995e351034

📥 Commits

Reviewing files that changed from the base of the PR and between 2ed0ce1 and 1ba7943.

📒 Files selected for processing (1)
  • .github/workflows/code-check.yml

📝 Walkthrough

Walkthrough

Adds GIF encoding (two-pass FFmpeg palette) to the video generator, exposes --output-gif and --crf CLI options, consolidates frame generation for MP4 and GIF, and integrates Ruff-based Python lint/format tooling into CI and npm scripts.

Changes

Cohort / File(s) Summary
Video Generation Enhancement
​.claude/skills/erode-video/scripts/generate_video.py
Added encode_gif(frames_dir, output_path, fps) implementing two-pass FFmpeg palette GIF encoding, added --output-gif and --crf CLI options, ensure output dirs exist, generate frames once and encode MP4+GIF sequentially, plus minor styling tweaks.
CI / Linting Workflow
.github/workflows/code-check.yml
Added Ruff steps to the check job: ruff check and ruff format --check.
Ruff Configuration
ruff.toml
New Ruff config targeting Python 3.13, line-length 100, enabled rule categories, docstring code formatting settings.
Package Scripts
package.json
Added npm scripts: lint:python → ruff check, format:python → ruff format, format:python:check → ruff format --check.
Tooling Ignore
knip.json
Extended ignoreBinaries to include ruff.

Sequence Diagram(s)

sequenceDiagram
    %% Colors: Client (rgba), Generator, FFmpeg, Filesystem
    participant CLI as "CLI\n(rgba(52,160,235,0.5))"
    participant Gen as "Frame Generator\n(rgba(72,201,176,0.5))"
    participant FF as "FFmpeg\n(rgba(255,203,5,0.5))"
    participant FS as "Filesystem\n(rgba(155,89,182,0.5))"

    CLI->>Gen: run (generate frames)
    Gen->>FS: write frames to frames_dir
    CLI->>FF: invoke MP4 encode with frames_dir
    FF->>FS: write MP4 output
    CLI->>FF: invoke two-pass GIF encode (palettegen + paletteuse) with frames_dir
    FF->>FS: write GIF output
    FS-->>CLI: return output paths
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through frames and spun a gif delight,
Two-pass palette shimmered in the night,
Ruff tidied fur and kept the lines neat,
MP4 and GIF now both dance to my beat,
Hooray — pixels prance and build a sight! 🎬✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'ci: add ruff for python linting and formatting' accurately summarizes the main changes: introducing ruff configuration, CI job, and npm scripts for Python code quality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/add-ruff-linting

Comment @coderabbitai help to get the list of available commands and usage tips.

@parse
parse merged commit e7ef962 into main Mar 4, 2026
1 of 2 checks passed
@parse
parse deleted the ci/add-ruff-linting branch March 4, 2026 12:17
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.

1 participant