Skip to content

Commit

Permalink
fix linter configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mscheltienne committed Aug 16, 2024
1 parent bbf0538 commit 920b335
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ full = [
'nmod_wiki[all]',
]
stubs = [
'isort',
'mypy',
'ruff>=0.1.8',
'ruff>=0.6.0',
]
style = [
'bibclean',
Expand Down
9 changes: 5 additions & 4 deletions tools/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from importlib import import_module
from pathlib import Path

import isort
from mypy import stubgen

import nmod_wiki
Expand Down Expand Up @@ -33,7 +32,6 @@
)
stubs = list(directory.rglob("*.pyi"))
config = str(directory.parent / "pyproject.toml")
config_isort = isort.settings.Config(config)

# expand docstrings and inject into stub files
for stub in stubs:
Expand All @@ -59,9 +57,12 @@
method.body[0].value.value = docstring
unparsed = ast.unparse(module_ast)
stub.write_text(unparsed, encoding="utf-8")
# sort imports
isort.file(stub, config=config_isort)

# run ruff to improve stub style
execution = subprocess.run(
["ruff", "check", str(directory), "--fix", "--unsafe-fixes", "--config", config]
)
if execution.returncode:
sys.exit(execution.returncode)
execution = subprocess.run(["ruff", "format", str(directory), "--config", config])
sys.exit(execution.returncode)

0 comments on commit 920b335

Please sign in to comment.