Skip to content

Commit

Permalink
Merge pull request #21 from abzrg/tool_lint
Browse files Browse the repository at this point in the history
Add linting tool: flake8 both to pyproject.toml and CI pipeline
  • Loading branch information
gerlero authored Mar 21, 2024
2 parents 3a3fa39 + 48d79cd commit 90b1f2c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Format code with Black
uses: psf/black@stable

typing:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -27,12 +27,15 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install typing dependencies
- name: Install linting dependencies
run: |
pip install .[lint]
- name: Check types with mypy
run: |
mypy
- name: Check code style with flake8
run: |
flake8
test:
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ lint = [
"pytest-asyncio>=0.21,<0.24",
"numpy>=1,<2",
"black",
"flake8",
"Flake8-pyproject",
]
test = [
"pytest>=7,<9",
Expand Down Expand Up @@ -71,3 +73,22 @@ packages = [
"tests",
]
strict = true

[tool.flake8]
count = true
ignore = [
"E203", # whitespace before ':'
"E501", # line too long
"E704", # multiple statements on one line (def)
"F403", # 'from foamlib import *' used; unable to detect undefined names
"F405", # 'FoamDimensionSet' may be undefined, or defined from star imports: foamlib
"W503", # line break before binary operator
]
exclude = [
".git",
"__pycache__",
"docs/source/conf.py",
"build",
"dist",
"venv",
]
4 changes: 2 additions & 2 deletions tests/test_dictionaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def test_parse() -> None:
assert _parse("1") == 1
assert _parse("1.0") == 1.0
assert _parse("1.0e-3") == 1.0e-3
assert _parse("yes") == True
assert _parse("no") == False
assert _parse("yes") is True
assert _parse("no") is False
assert _parse("uniform 1") == 1
assert _parse("uniform 1.0") == 1.0
assert _parse("uniform 1.0e-3") == 1.0e-3
Expand Down

0 comments on commit 90b1f2c

Please sign in to comment.