Refactor linting workflow to use pre-commit #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
)ruff check .
andmypy starter_repo tests
commands withpre-commit run --all-files
2. Updated Pre-commit Configuration (
.pre-commit-config.yaml
)charliermarsh/ruff-pre-commit
toastral-sh/ruff-pre-commit
v0.1.6
tov0.4.4
v1.7.1
tov1.10.0
files: ^(starter_repo|tests)/
to mypy hook to target the same directories as the original workflowadditional_dependencies: [pandas-stubs]
to mypy hook to ensure proper type checking3. Updated Documentation (
README.md
)Benefits
Testing
pre-commit run --all-files
ruff check .
andmypy starter_repo tests
pytest
The refactoring maintains backward compatibility while providing a more streamlined and consistent linting experience.