diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0511e10..dddaf6e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -28,6 +28,7 @@ }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ + "charliermarsh.ruff", "mhutchie.git-graph", "ms-python.python", "njpwerner.autodocstring", diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1ad6def..a4315ca 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,19 +1,19 @@ repos: ###### FORMATTING ###### - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + # Ruff version. + rev: v0.3.5 hooks: - - id: black - language_version: python3 # Should be a command that runs python3.6+ + # Run the linter. + - id: ruff + name: ruff lint + types_or: [ python, pyi, jupyter ] + args: [ --fix ] - - repo: https://github.com/PyCQA/isort - rev: 5.12.0 - hooks: - - id: isort - name: isort (python) - - id: isort - name: isort (pyi) - types: [pyi] + # Run the formatter. + - id: ruff-format + name: ruff format + types_or: [ python, pyi, jupyter ] ###### LINTING ###### - repo: https://github.com/PyCQA/bandit @@ -22,18 +22,6 @@ repos: - id: bandit args: ["--configfile", ".bandit", "--baseline", "tests/known_issues.json"] - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - # any flake8 plugins must be included in the hook venv - # additional_dependencies: [flake8-docstrings] - - # - repo: https://github.com/PyCQA/pylint - # rev: v2.8.2 - # hooks: - # - id: pylint - - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 97f5037..d393fa7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,17 @@ -[tool.black] +[tool.ruff] line-length = 100 -target-version = ['py37'] +exclude = [".git", "__pycache__", "old", "build", "dist", "*.egg-info"] + +[tool.ruff.lint] +# https://docs.astral.sh/ruff/rules/ +select = ["F", "T20", "PL", "I"] +ignore = ["PLR0913", "PLR2004", "PLR0912"] + +[tool.ruff.lint.per-file-ignores] +"**/tests/*" = ["F811"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +docstring-code-format = true +docstring-code-line-length = "dynamic"