Skip to content

Commit d12410b

Browse files
authored
Merge pull request #68 from jschneidereit/jschneidereit/64-add-ruff
Add ruff and remove everything it replaces
2 parents 8eadd12 + 2dcf3db commit d12410b

File tree

6 files changed

+34
-46
lines changed

6 files changed

+34
-46
lines changed

.github/workflows/build.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- uses: actions/setup-java@v3
3838
with:
39-
java-version: '8'
39+
java-version: '11'
4040
distribution: 'zulu'
4141
cache: 'maven'
4242

@@ -56,22 +56,10 @@ jobs:
5656
- uses: actions/setup-python@v3
5757

5858
- name: Lint code
59-
uses: psf/black@stable
60-
61-
- name: Flake code
62-
run: |
63-
python -m pip install flake8 Flake8-pyproject flake8-typing-imports
64-
python -m flake8 src tests
65-
66-
- name: Check import ordering
67-
uses: isort/isort-action@master
68-
with:
69-
configuration: --check-only
70-
71-
- name: Validate pyproject.toml
7259
run: |
73-
python -m pip install validate-pyproject[all]
74-
python -m validate_pyproject pyproject.toml
60+
python -m pip install ruff
61+
ruff check
62+
ruff format --check
7563
7664
conda-dev-test:
7765
name: Conda Setup & Code Coverage

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ check:
2020
lint: check
2121
bin/lint.sh
2222

23+
fmt: check
24+
bin/fmt.sh
25+
2326
test: check
2427
bin/test.sh
2528

bin/fmt.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
dir=$(dirname "$0")
4+
cd "$dir/.."
5+
6+
exitCode=0
7+
ruff check --fix
8+
code=$?; test $code -eq 0 || exitCode=$code
9+
ruff format
10+
code=$?; test $code -eq 0 || exitCode=$code
11+
exit $exitCode

bin/lint.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ dir=$(dirname "$0")
44
cd "$dir/.."
55

66
exitCode=0
7-
black src tests
7+
ruff check
88
code=$?; test $code -eq 0 || exitCode=$code
9-
isort src tests
10-
code=$?; test $code -eq 0 || exitCode=$code
11-
python -m flake8 src tests
12-
code=$?; test $code -eq 0 || exitCode=$code
13-
validate-pyproject pyproject.toml
9+
ruff format --check
1410
code=$?; test $code -eq 0 || exitCode=$code
1511
exit $exitCode

dev-environment.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,13 @@ dependencies:
2828
- pandas
2929
# Developer tools
3030
- assertpy
31-
- autopep8
32-
- black
33-
- build
34-
- flake8
35-
- isort
3631
- pytest
3732
- pytest-cov
33+
- ruff
3834
- toml
3935
# Project from source
4036
- pip
4137
- pip:
4238
- git+https://github.com/ninia/jep.git@cfca63f8b3398daa6d2685428660dc4b2bfab67d
43-
- flake8-pyproject
44-
- flake8-typing-imports
45-
- validate-pyproject[all]
39+
- build
4640
- -e .

pyproject.toml

+12-16
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,14 @@ dependencies = [
4040
# NB: Keep this in sync with dev-environment.yml!
4141
dev = [
4242
"assertpy",
43-
"autopep8",
44-
"black",
4543
"build",
46-
"flake8",
47-
"flake8-pyproject",
48-
"flake8-typing-imports",
49-
"isort",
5044
"jep",
5145
"pytest",
5246
"pytest-cov",
5347
"numpy",
5448
"pandas",
55-
"toml",
56-
"validate-pyproject[all]",
49+
"ruff",
50+
"toml"
5751
]
5852

5953
[project.urls]
@@ -72,13 +66,15 @@ where = ["src"]
7266
namespaces = false
7367

7468
# Thanks to Flake8-pyproject, we can configure flake8 here!
75-
[tool.flake8]
76-
exclude = ["bin", "build", "dist"]
69+
[tool.ruff]
70+
line-length = 88
71+
src = ["src", "tests"]
72+
include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py"]
73+
extend-exclude = ["bin", "build", "dist"]
74+
75+
[tool.ruff.lint]
7776
extend-ignore = ["E203"]
78-
# See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
79-
max-line-length = 88
80-
min_python_version = "3.8"
81-
per-file-ignores = "__init__.py:F401"
8277

83-
[tool.isort]
84-
profile = "black"
78+
[tool.ruff.lint.per-file-ignores]
79+
# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
80+
"__init__.py" = ["E402", "F401"]

0 commit comments

Comments
 (0)