Merge pull request #587 from voidking/pr

feature: 支持pre-commit检查代码规范
This commit is contained in:
geekan 2023-12-21 10:19:15 +08:00 committed by GitHub
commit 168f83e917
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 3 deletions

30
.github/workflows/pre-commit.yaml vendored Normal file
View file

@ -0,0 +1,30 @@
name: Pre-commit checks
on:
pull_request:
branches:
- '**'
push:
branches:
- '**'
jobs:
pre-commit-check:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9.17'
- name: Install pre-commit
run: pip install pre-commit
- name: Initialize pre-commit
run: pre-commit install
- name: Run pre-commit hooks
run: pre-commit run --all-files

View file

@ -10,6 +10,7 @@
from pathlib import Path
import warnings
from pydantic import BaseModel, Field
from metagpt.actions import UserRequirement
@ -94,9 +95,12 @@ class Team(BaseModel):
Deprecated: This method will be removed in the future.
Please use the `run_project` method instead.
"""
warnings.warn("The 'start_project' method is deprecated and will be removed in the future. "
"Please use the 'run_project' method instead.",
DeprecationWarning, stacklevel=2)
warnings.warn(
"The 'start_project' method is deprecated and will be removed in the future. "
"Please use the 'run_project' method instead.",
DeprecationWarning,
stacklevel=2,
)
return self.run_project(idea=idea, send_to=send_to)
def _save(self):