Skip to content

Migrate from flake8 to ruff#7

Merged
pmclSF merged 7 commits intomainfrom
chore/migrate-flake8-to-ruff
Feb 16, 2026
Merged

Migrate from flake8 to ruff#7
pmclSF merged 7 commits intomainfrom
chore/migrate-flake8-to-ruff

Conversation

@pmclSF
Copy link
Owner

@pmclSF pmclSF commented Feb 15, 2026

Migrate from flake8 to ruff

What

Replace flake8 (which only linted a subset of files) with ruff, linting the
entire src/ and tests/ directory. Fix all existing violations to achieve
a clean baseline.

Why

  • flake8 CI only checked 8 source files and 5 test files — new code in other
    files was never linted
  • No import ordering enforcement existed
  • 4 undefined-name bugs (F821) were silently present — np.pi, np.save,
    np.load, and json.load used without imports, which would crash at runtime

Changes

  • Add pyproject.toml with ruff config (rules: F, I, E, W; line-length: 120)
  • Fix 4 real bugs: add missing import numpy as np and import json
  • Auto-fix 65 import ordering, ~450 whitespace, and 36 unused import violations
  • Manually fix 5 line-length, 5 unused variable, and 1 empty f-string violation
  • Replace CI lint job: ruff check src/ tests/ on the full codebase
  • Tests now depend on lint passing (needs: lint)
  • Add CLAUDE.md with linting standards

Testing

  • ruff check src/ tests/ → 0 violations
  • 119 tests pass, same count as before migration
  • No behavioral changes — only import ordering, whitespace, and dead code removal

🤖 Generated with Claude Code

pmclSF and others added 7 commits February 15, 2026 19:00
Add pyproject.toml with ruff linter config (rules: F, I, E, W; line-length 120)
and add ruff>=0.4.0 to requirements.txt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fix F821 violations that would crash at runtime:
- src/data_loader.py: add `import numpy as np` (used for np.pi)
- src/training_pipeline.py: add `import numpy as np` (used for np.save/np.load)
- tests/test_evaluation_pipeline.py: add `import json` (used for json.load)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Applied ruff auto-fixes across the entire codebase:
- 65 import ordering violations (I001) — stdlib, third-party, local
- ~450 whitespace violations (W291/W292/W293) — trailing whitespace
- 36 unused import violations (F401) — removed dead imports

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Manual fixes for violations that couldn't be auto-fixed:
- E501: break long lines in colorbar.py, compress_octree.py
- F841: remove unused variables in ds_mesh_to_pc.py, ds_pc_octree_blocks.py,
  test_model_transforms.py, test_parallel_process.py
- F541: remove empty f-string prefix in quick_benchmark.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace flake8 lint job with ruff check on all src/ and tests/
- Previously flake8 only checked 8 source + 5 test files
- Test job now depends on lint passing (needs: lint)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add CLAUDE.md with comprehensive coding guidelines
- Document ruff as the linter with F, I, E, W rule sets
- Add ruff check commands to Quick Reference
- Document known issues including pre-existing test failures

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…to-ruff

# Conflicts:
#	src/data_loader.py
#	src/evaluation_pipeline.py
#	src/mp_report.py
#	src/octree_coding.py
#	src/training_pipeline.py
#	tests/test_colorbar.py
#	tests/test_compress_octree.py
#	tests/test_data_loader.py
#	tests/test_ds_mesh_to_pc.py
#	tests/test_ds_pc_octree_blocks.py
#	tests/test_entropy_model.py
#	tests/test_evaluation_pipeline.py
#	tests/test_experiment.py
#	tests/test_integration.py
#	tests/test_map_color.py
#	tests/test_mp_report.py
#	tests/test_octree_coding.py
#	tests/test_parallel_process.py
#	tests/test_point_cloud_metricss.py
#	tests/test_training_pipeline.py
@pmclSF pmclSF merged commit 00a6fbc into main Feb 16, 2026
1 of 2 checks passed
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