Repository navigation
Add pre-commit configuration and improve code quality checks - #6
Merged
Merged
Conversation
- Introduced .djlintrc, .isort.cfg, .prettierignore, .prettierrc.yaml, and ruff.toml for code quality checks. - Updated .editorconfig to align with new formatting standards. - Modified CI workflow to utilize pre-commit for linting and formatting. - Enhanced CONTRIBUTING.md to include pre-commit installation instructions. - Updated requirements-dev.txt to include pre-commit as a dependency. - Improved test cases for better readability and consistency.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this change?
This pull request introduces a standardized pre-commit code style and formatting setup across the repository, aligning it with OctoPrint core and plugin best practices. It adds configuration files for tools like pre-commit, isort, ruff, djlint, and prettier, and updates CI workflows to use these tools. The codebase and documentation have been updated to follow the new formatting and linting standards, and some minor code cleanups have been performed.
Pre-commit and Formatting Tooling:
.pre-commit-config.yamlto define a consistent set of pre-commit hooks (isort, ruff, djlint, prettier, codespell, shellcheck, etc.) for code formatting and quality checks..isort.cfg), ruff (ruff.toml), djlint (.djlintrc), and prettier (.prettierrc.yaml,.prettierignore) to enforce consistent code style across Python, Jinja, and frontend files. [1] [2] [3] [4] [5]Continuous Integration (CI) Workflow Updates:
.github/workflows/ci.ymlto use pre-commit for linting instead of ruff directly, removed unnecessary Node.js/ShellCheck setup, and improved Codacy coverage upload with better environment variable handling and error tolerance. [1] [2] [3] [4] [5]Documentation Improvements:
CONTRIBUTING.mdto instruct contributors to install and use pre-commit, and clarified that code style is now enforced by pre-commit hooks. [1] [2]Python Codebase Formatting and Cleanup:
octoprint_swapxyz/__init__.py,setup.py, tests) to comply with the new style (e.g., removal of legacyfrom __future__imports, consistent trailing commas, function argument formatting, improved exception handling). [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Other Notable Changes:
pre-committorequirements-dev.txtto ensure it's installed in development environments. (F4d4a689L1)These changes collectively ensure that code quality and formatting are automatically enforced, making contributions easier and more consistent across the project.
Closes #
Type of change
How was it tested?
Checklist