-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: impose strict linter rules via ruff (#8)
* feat: impose strict linter rules via ruff * chore: add CI * fix: ruff check --fix * format: ruff format . * chore: remove useless files * chore: follow the ruff rules * Updated backend-ci.yml to include pre-commit checks for flake8, mypy, pydantic, types-requests, and types-redis. * chore: adjust steps order in backend-ci.yml * chore: add config path * chore: updated pre-commit action to include all files and specified configuration file. * chore: updated pre-commit action to remove --all-files flag in backend-ci.yml. * chore: updated pre-commit action to include all files in the backend directory for linting. * chore: updated pre-commit configuration to only run on files within the backend directory. * chore: updated backend-ci.yml to include installation of ruff package for linting and formatting. * chore: lint config for backend * chore: update pre-commit configuration to use pyproject.toml instead of setup.cfg * chore: refactor pre-commit config to use pyproject.toml instead of setup.cfg in backend directory. * chore: updated pre-commit job in backend-ci.yml to remove unnecessary configuration for working directory and specify files directly for pre-commit checks. * chore: updated mypy version to 1.10.0 and added new error codes to disable in pyproject.toml --------- Co-authored-by: Thomas <wxy_000000@qq.com> Co-authored-by: BirdRing <zhkkun@gmail.com>
- Loading branch information
1 parent
ba577f0
commit 46f9fde
Showing
41 changed files
with
1,240 additions
and
1,569 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: backend code quality | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'main' | ||
- 'prod' | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- run: pip install flake8 mypy pydantic types-requests types-redis ruff | ||
- uses: pre-commit/action@v3.0.0 | ||
with: | ||
extra_args: --files ./backend/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: check-ast | ||
files: ^backend/ | ||
- id: check-case-conflict | ||
files: ^backend/ | ||
- id: check-docstring-first | ||
files: ^backend/ | ||
- id: check-executables-have-shebangs | ||
files: ^backend/ | ||
- id: check-json | ||
files: ^backend/ | ||
- id: check-added-large-files | ||
files: ^backend/ | ||
- id: pretty-format-json | ||
args: | ||
- "--autofix" | ||
- "--indent=4" | ||
files: ^backend/ | ||
- id: detect-private-key | ||
files: ^backend/ | ||
- id: debug-statements | ||
files: ^backend/ | ||
- id: end-of-file-fixer | ||
files: ^backend/ | ||
- id: trailing-whitespace | ||
files: ^backend/ | ||
- repo: local | ||
hooks: | ||
- id: mypy | ||
name: mypy | ||
entry: mypy . | ||
require_serial: true | ||
language: system | ||
types: [ python ] | ||
files: ^backend/ | ||
pass_filenames: false | ||
args: [--config-file=backend/pyproject.toml] | ||
- id: ruff-lint | ||
name: ruff-lint | ||
entry: ruff check --fix | ||
require_serial: true | ||
language: system | ||
files: ^backend/ | ||
types: [ python ] | ||
- id: ruff-format | ||
name: ruff-format | ||
entry: ruff format | ||
require_serial: true | ||
language: system | ||
files: ^backend/ | ||
types: [ python ] |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
def init_cache(): | ||
# langchain.llm_cache = InMemoryCache() | ||
def init_cache() -> None: | ||
pass |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.