Skip to content

Commit 4f6d8dd

Browse files
committed
Add ruff linter
1 parent 3ca0c61 commit 4f6d8dd

File tree

5 files changed

+51
-3
lines changed

5 files changed

+51
-3
lines changed

.github/workflows/lint.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ruff:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
- name: Install ruff
12+
run: pip install ruff
13+
- name: Check style
14+
run: ruff check --config .ruff.toml pyscf
15+
- name: Check NumPy
16+
run: ruff check --select NPY --ignore NPY002 pyscf

.ruff.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
exclude = [
2+
"test",
3+
]
4+
5+
respect-gitignore = true
6+
line-length = 120
7+
8+
[lint]
9+
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
10+
#select = ["E4", "E7", "E9", "F"]
11+
ignore = [
12+
# Whitespaces:
13+
"E201", "E202", "E203", "E211", "E221", "E222", "E225", "E226", "E228", "E231", "E241", "E251",
14+
# Comments:
15+
"E261", "E262", "E265", "E266",
16+
# Blank lines:
17+
"E301", "E302", "E303", "E305", "E306",
18+
# Imports:
19+
"E401", "E402",
20+
# Other:
21+
"E701", "E713", "E721", "E731", "E741", "E275",
22+
"F401", "F403", "C901", "W391"
23+
]
24+
25+
[format]
26+
# Like Black, indent with spaces, rather than tabs.
27+
indent-style = "space"
28+
29+
# Like Black, automatically detect the appropriate line ending.
30+
line-ending = "auto"
31+
32+
quote-style = "single"

pyscf/dispersion/tests/test_d3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def test_d3_unknown_xc():
2222
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')
2323
with pytest.raises(RuntimeError):
24-
model = DFTD3Dispersion(mol, xc='wb97x-v')
24+
DFTD3Dispersion(mol, xc='wb97x-v')
2525

2626
def test_d3_energy():
2727
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')

pyscf/dispersion/tests/test_d4.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
def test_d4_unknown_xc():
2222
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')
2323
with pytest.raises(RuntimeError):
24-
model = DFTD4Dispersion(mol, xc='wb97x-v')
24+
DFTD4Dispersion(mol, xc='wb97x-v')
2525

2626
def test_d4_energy():
2727
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')

pyscf/dispersion/tests/test_gcp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def test_gcp_unknown_xc():
2222
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')
2323
with pytest.raises(RuntimeError):
2424
model = GCP(mol, method='xx')
25-
out = model.get_counterpoise()
25+
model.get_counterpoise()
2626

2727
def test_b973c_energy():
2828
mol = pyscf.M(atom='H 0 0 0; H 0 0 1')

0 commit comments

Comments
 (0)