Skip to content

Commit 1b810cf

Browse files
BordaiFurySt
andauthored
ci/lint: fix calling Ruff's format (OpenHands#1457)
* ci/lint: fix calling Ruff's format * Transition for ruff lint. Only checking the modified files. --------- Co-authored-by: ifuryst <[email protected]>
1 parent cfef3ee commit 1b810cf

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/lint.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
runs-on: ubuntu-latest
3434
steps:
3535
- uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
3638
- name: Set up python
3739
uses: actions/setup-python@v5
3840
with:
@@ -42,7 +44,9 @@ jobs:
4244
run: pip install pre-commit==3.7.0
4345
- name: Run pre-commit hooks
4446
run: |
47+
git fetch https://github.com/OpenDevin/OpenDevin.git main:main && \
4548
pre-commit run \
46-
--all-files \
49+
--files \
50+
$(git diff --name-only $(git merge-base main $(git branch --show-current)) $(git branch --show-current) | tr '\n' ' ') \
4751
--show-diff-on-failure \
4852
--config ./dev_config/python/.pre-commit-config.yaml

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ install-precommit-hooks:
150150

151151
lint:
152152
@echo "$(YELLOW)Running linters...$(RESET)"
153-
@poetry run pre-commit run --all-files --show-diff-on-failure --config $(PRECOMMIT_CONFIG_PATH)
153+
@poetry run pre-commit run --files $$(git diff --name-only $$(git merge-base main $$(git branch --show-current)) $$(git branch --show-current) | tr '\n' ' ') --show-diff-on-failure --config $(PRECOMMIT_CONFIG_PATH)
154154

155155
build-frontend:
156156
@echo "$(YELLOW)Building frontend...$(RESET)"

dev_config/python/.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ repos:
2020

2121
- repo: https://github.com/astral-sh/ruff-pre-commit
2222
# Ruff version.
23-
rev: v0.3.7
23+
rev: v0.4.1
2424
hooks:
2525
# Run the linter.
2626
- id: ruff
27-
entry: ruff check --config dev_config/python/ruff.toml opendevin/ agenthub/
27+
entry: ruff check --config dev_config/python/ruff.toml
2828
types_or: [python, pyi, jupyter]
2929
args: [--fix]
3030
# Run the formatter.
3131
- id: ruff-format
32-
entry: ruff check --config dev_config/python/ruff.toml opendevin/ agenthub/
32+
entry: ruff format --config dev_config/python/ruff.toml
3333
types_or: [python, pyi, jupyter]
3434

3535
- repo: https://github.com/pre-commit/mirrors-mypy

dev_config/python/ruff.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ ignore = [
1515
"E501",
1616
]
1717

18-
flake8-quotes = {inline-quotes = "single"}
18+
[lint.flake8-quotes]
19+
docstring-quotes = "double"
20+
inline-quotes = "single"
1921

2022
[format]
2123
quote-style = "single"

0 commit comments

Comments
 (0)