Skip to content

Add ruff linting and auto-format generated code#47

Merged
twiecki merged 2 commits intomainfrom
add-auto-linting
Mar 16, 2026
Merged

Add ruff linting and auto-format generated code#47
twiecki merged 2 commits intomainfrom
add-auto-linting

Conversation

@twiecki
Copy link
Copy Markdown
Collaborator

@twiecki twiecki commented Mar 16, 2026

Summary

  • Add ruff configuration to pyproject.toml (line-length=120, select E/F/I/W rules)
  • Fix all existing lint and formatting issues across the codebase
  • Add transpailer/formatting.py utility that runs ruff format on code strings
  • Integrate auto-formatting into the LLM code generation pipeline: generated Python code from stan_to_pymc and jax_pytorch_transpiler is now automatically formatted via ruff before being stored/returned

This ensures CI lint checks pass and that all LLM-generated code is properly formatted by design.

Test plan

  • ruff check . passes
  • ruff format --check . passes
  • CI should pass on this PR
  • Verify generated code from transpilation is properly formatted

🤖 Generated with Claude Code

twiecki and others added 2 commits March 16, 2026 17:38
- Add ruff configuration to pyproject.toml (line-length=120, E/F/I/W rules)
- Fix all existing lint errors (unused imports, f-strings, import sorting)
- Format all files with ruff format
- Add transpailer/formatting.py utility that formats Python code via ruff
- Integrate auto-formatting into code generation: LLM-generated Python code
  is now automatically formatted before being stored/returned in both
  stan_to_pymc and jax_pytorch_transpiler pipelines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ruff format adds a trailing newline, so use .strip() in assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@twiecki twiecki merged commit c30829a into main Mar 16, 2026
3 checks passed
@twiecki twiecki deleted the add-auto-linting branch March 16, 2026 05:01
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