Skip to content

Add Ruff linting, pre-commit hooks, and CI#80

Open
korbonits wants to merge 1 commit into
lmgame-org:mainfrom
korbonits:add-ruff-ci
Open

Add Ruff linting, pre-commit hooks, and CI#80
korbonits wants to merge 1 commit into
lmgame-org:mainfrom
korbonits:add-ruff-ci

Conversation

@korbonits

Copy link
Copy Markdown

Summary

Adds Ruff linting + CI enforcement to catch style and correctness issues on every PR.

Changes:

  • pyproject.toml: add [tool.ruff] config (E/F/I rules, line-length 120, notebooks excluded)
  • .pre-commit-config.yaml: ruff + ruff-format hooks
  • .github/workflows/lint.yml: lint job via uv on push/PR
  • computer_use/games/tetris/workers.py: fix E101 mixed tabs/spaces (expanded tabs to 4 spaces)

Auto-fixed 276 import-sort and style violations.

Items flagged for maintainer attention (suppressed in config so CI passes):

  • F821 — Potential NameErrors:
    • sokoban_agent.py:578: references e but the surrounding except clause has no as e binding
    • lmgame-bench/single_agent_runner.py:408,426: references model_name_arg which is not defined in the enclosing scope at that point
    • tools/serving/api_manager.py:1128: references token_limit before assignment
  • F811estimate_token_count imported on line 19 of tools/serving/api_providers.py then immediately re-defined as a function on line 29; the import is dead
  • E712 — 19 equality comparisons to True/False (e.g. if x == True:) across multiple files; use if x: instead

Ruff version: v0.12.2

- Add [tool.ruff] config to pyproject.toml (E/F/I rules, line-length 120)
- Add .pre-commit-config.yaml with ruff + ruff-format hooks
- Add .github/workflows/lint.yml CI job via uv
- Fix E101: mixed tabs/spaces in computer_use/games/tetris/workers.py

Auto-fixed 276 import-sort and style violations. Remaining notes (suppressed in config):
- F821: undefined names 'e' in sokoban_agent.py:578 (bare except without
  'as e' binding), 'model_name_arg' in single_agent_runner.py:408,426,
  and 'token_limit' in tools/serving/api_manager.py:1128 — all potential
  NameErrors at runtime
- F811: estimate_token_count redefined in tools/serving/api_providers.py:29
  (import on line 19 overwritten by function definition on line 29)
- E712: 19 equality comparisons to True/False across multiple files
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