Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: 支持pre-commit检查代码规范 #587

Merged
merged 2 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 7 additions & 3 deletions metagpt/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pathlib import Path
import warnings

from pydantic import BaseModel, Field

from metagpt.actions import UserRequirement
Expand Down Expand Up @@ -94,9 +95,12 @@ def start_project(self, idea, send_to: str = ""):
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):
Expand Down