在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用python-code-style
星标0
分支1
更新时间2026年1月14日 03:56
Python 코드 스타일 검사 및 품질 관리 가이드
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
Python 코드 스타일 검사 및 품질 관리 가이드
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | python-code-style |
| description | Python 코드 스타일 검사 및 품질 관리 가이드 |
| version | 1.0.0 |
| tags | ["python","linting","code-quality","ruff","mypy"] |
| author | deep-research-MAF |
Python 코드 스타일 검사 및 품질 관리를 위한 가이드
현재 프로젝트에서 사용 중인 fast Python linter & formatter
# UV를 사용하여 dev 의존성으로 설치
uv add --dev ruff
# 또는 직접 실행 (설치 없이)
uvx ruff
# 코드 스타일 체크
ruff check .
# 자동 수정 가능한 문제 수정
ruff check . --fix
# 포맷팅
ruff format .
# 특정 파일/디렉토리 체크
ruff check backend/src
[tool.ruff]
line-length = 88
target-version = "py312"
[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"UP", # pyupgrade
]
ignore = [
"E501", # line too long
]
[tool.ruff.lint.isort]
known-first-party = ["src"]
코드 포맷터로 사용 가능
uv add --dev black
black backend/src
black --check backend/src # 체크만 (수정 안 함)
# 또는 uvx로 직접 실행
uvx black backend/src
타입 체킹
uv add --dev mypy
mypy backend/src
# 또는 uvx로 직접 실행
uvx mypy backend/src
[tool.mypy]
python_version = "3.12"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
상세한 코드 분석
uv add --dev pylint
pylint backend/src
# 또는 uvx로 직접 실행
uvx pylint backend/src
PEP 8 준수
Import 정렬
# Standard library imports
import os
import sys
# Third-party imports
import fastapi
import pydantic
# Local imports
from src.models import Query
from src.services import AzureOpenAIService
타입 힌트 사용
def process_query(query: str, max_results: int = 10) -> list[str]:
"""Process search query and return results."""
results: list[str] = []
return results
Docstring 작성
def complex_function(param1: str, param2: int) -> dict:
"""
Brief description of the function.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ValueError: When invalid input is provided
"""
pass
uv add --dev pre-commit
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
pre-commit install
name: Code Quality
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
pip install uv
uv sync --dev
- name: Run Ruff
run: ruff check .
- name: Run MyPy
run: mypy backend/src
# 스타일 체크
ruff check .
# 타입 체크
mypy backend/src
# 자동 포맷팅
ruff format .
ruff check backend/src/main.py
mypy backend/src/main.py
git diff --name-only --cached | grep '\.py$' | xargs ruff check
ruff check --select I --fix .
ruff check --select F401 --fix .
ruff format . # 자동으로 포맷팅
{
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true
}
},
"ruff.lint.args": ["--config=backend/pyproject.toml"]
}