mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-06-16 21:06:15 +03:00
ci: lint the full repository
With the tree clean, the lint job runs ruff check . on every push and PR rather than only the files a PR changes, so a lint regression is caught anywhere.
This commit is contained in:
24
.github/workflows/ci.yml
vendored
24
.github/workflows/ci.yml
vendored
@@ -46,30 +46,16 @@ jobs:
|
|||||||
python -c "import tradingagents, cli.main; print('clean-install import OK')"
|
python -c "import tradingagents, cli.main; print('clean-install import OK')"
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
name: ruff (changed files, strict)
|
name: ruff (strict, full repo)
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
- name: Install ruff
|
- name: Install ruff
|
||||||
run: pip install "ruff>=0.15"
|
run: pip install "ruff>=0.15"
|
||||||
- name: Lint only the Python files this PR changes
|
- name: Lint the repository
|
||||||
env:
|
# The repo is fully clean under the strict select, so we lint everything
|
||||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
# (results/ and worklog/ are excluded via pyproject extend-exclude).
|
||||||
run: |
|
run: ruff check .
|
||||||
# Strict going-forward gate: the full-repo cleanup is deferred (see
|
|
||||||
# worklog 03/01), so we lint only files this PR adds or modifies.
|
|
||||||
files=$(git diff --name-only --diff-filter=ACM "$BASE_SHA"...HEAD -- '*.py' \
|
|
||||||
| grep -vE '^(results|worklog)/' || true)
|
|
||||||
if [ -z "$files" ]; then
|
|
||||||
echo "No Python changes to lint."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
echo "Linting changed files:"
|
|
||||||
echo "$files"
|
|
||||||
ruff check $files
|
|
||||||
|
|||||||
Reference in New Issue
Block a user