Skip to content

Conversation

neubig
Copy link
Owner

@neubig neubig commented Jun 16, 2025

Summary

This PR refactors the linting workflow to use pre-commit instead of running ruff and mypy separately, consolidating the linting tools under a single command while maintaining the same linting behavior.

Changes Made

1. Updated GitHub Actions Workflow (.github/workflows/lint.yml)

  • Replaced separate ruff check . and mypy starter_repo tests commands with pre-commit run --all-files
  • Simplified the workflow while maintaining the same linting checks

2. Updated Pre-commit Configuration (.pre-commit-config.yaml)

  • Updated ruff repository URL from charliermarsh/ruff-pre-commit to astral-sh/ruff-pre-commit
  • Upgraded ruff version from v0.1.6 to v0.4.4
  • Upgraded mypy version from v1.7.1 to v1.10.0
  • Added files: ^(starter_repo|tests)/ to mypy hook to target the same directories as the original workflow
  • Added additional_dependencies: [pandas-stubs] to mypy hook to ensure proper type checking

3. Updated Documentation (README.md)

  • Updated the description of the linting workflow to reflect that it now uses pre-commit hooks

Benefits

  • Consistency: Developers and CI now use the same linting commands
  • Maintainability: Single source of truth for linting configuration
  • Efficiency: Pre-commit can cache environments and run hooks in parallel
  • Developer Experience: Pre-commit hooks can be installed locally to run automatically on commit

Testing

  • ✅ All pre-commit hooks pass: pre-commit run --all-files
  • ✅ Individual tools still work: ruff check . and mypy starter_repo tests
  • ✅ All tests pass: pytest
  • ✅ No changes to actual linting behavior or rules

The refactoring maintains backward compatibility while providing a more streamlined and consistent linting experience.

- Updated .github/workflows/lint.yml to use pre-commit instead of running ruff and mypy separately
- Updated .pre-commit-config.yaml with latest versions and proper mypy configuration
- Updated README.md to reflect the workflow changes
- Maintains same linting behavior while consolidating tools under pre-commit
@neubig neubig marked this pull request as ready for review June 16, 2025 00:22
@neubig neubig merged commit 39db632 into main Jun 16, 2025
3 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.

2 participants