Skip to content

Commit

Permalink
Add ruff (run-llama#881)
Browse files Browse the repository at this point in the history
  • Loading branch information
cry-stal-lee authored Mar 25, 2023
1 parent a9f8989 commit 56c8d40
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 24 deletions.
13 changes: 0 additions & 13 deletions .flake8

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ coverage.xml
*.py,cover
.hypothesis/
.pytest_cache/
.ruff_cache

# Translations
*.mo
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.243
hooks:
- id: ruff
8 changes: 7 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,13 @@ You can format and lint your changes with the following commands in the root dir
make format; make lint
```

We run an assortment of linters: `black`, `isort`, `mypy`, `flake8`.
You can also make use of our pre-commit hooks by setting up git hook scripts:

```bash
pre-commit install
```

We run an assortment of linters: `black`, `ruff`, `mypy`.

### Testing

Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

format:
black .
isort .

lint:
mypy .
black . --check
isort . --check
flake8 .
ruff check .

test:
pytest tests
pytest tests
14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
[tool.isort]
profile = "black"

[tool.mypy]
ignore_missing_imports = "True"
disallow_untyped_defs = "True"
exclude = ["notebooks", "build", "examples"]

[tool.ruff]
exclude = [
".venv",
"__pycache__",
".ipynb_checkpoints",
".mypy_cache",
".ruff_cache",
"examples",
"notebooks",
]
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ types-setuptools==67.1.0.0

# linting
black==22.12.0
isort==5.11.4
mypy==0.991
flake8==6.0.0
flake8-docstrings==1.6.0
pre-commit==3.2.0
pylint==2.15.10
ruff==0.0.259

0 comments on commit 56c8d40

Please sign in to comment.