diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 63c524a..e07f6b0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,8 +32,8 @@ jobs: with: provider: microk8s channel: 1.28-strict/stable - juju-channel: 3.2 - bootstrap-options: '--agent-version=3.2.0' + juju-channel: 3.4/stable + bootstrap-options: '--agent-version=3.4.2' - name: Run integration tests run: tox -e build-prerequisites,integration -- --model testing diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e41fbc2..bdfbeb7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,10 +14,7 @@ repos: hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] -- repo: https://github.com/psf/black - rev: 24.4.0 - hooks: - - id: black + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.9.0 hooks: diff --git a/fmt-requirements.txt b/fmt-requirements.txt index dc109e2..af3ee57 100644 --- a/fmt-requirements.txt +++ b/fmt-requirements.txt @@ -1,2 +1 @@ -black ruff diff --git a/lint-requirements.txt b/lint-requirements.txt index 0943b53..8fde0d3 100644 --- a/lint-requirements.txt +++ b/lint-requirements.txt @@ -1,3 +1,2 @@ -black codespell ruff diff --git a/pyproject.toml b/pyproject.toml index edfa763..3508d5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,16 +22,24 @@ show_missing = true minversion = "6.0" log_cli_level = "INFO" -# Formatting tools configuration -[tool.black] -line-length = 99 -target-version = ["py310", "py311"] - -# Linting tools configuration +# Linting and formatting tools configuration [tool.ruff] +# Default settings: https://docs.astral.sh/ruff/configuration/ +# Settings: https://docs.astral.sh/ruff/settings/ line-length = 99 +include = ["pyproject.toml", "src/**/*.py", "tests/**/*.py", "lib/charms/glauth_utils/**/*.py"] +extend-exclude = ["__pycache__", "*.egg_info"] + +[too.ruff.lint] +# Rules: https://docs.astral.sh/ruff/rules/ select = ["E", "W", "F", "C", "N", "D", "I001"] -extend-ignore = [ +ignore = [ + "D100", + "D101", + "D102", + "D103", + "D105", + "D107", "D203", "D204", "D213", @@ -43,17 +51,22 @@ extend-ignore = [ "D408", "D409", "D413", + "E501", + "N818" ] -ignore = ["D100", "D101", "D102", "D103", "D105", "D107", "E501", "N818"] -extend-exclude = ["__pycache__", "*.egg_info"] per-file-ignores = {"tests/*" = ["D100","D101","D102","D103","D104"]} -[tool.ruff.mccabe] +[too.ruff.lint.flake8-copyright] +author = "Canonical Ltd." +notice-rgx = "Copyright\\s\\d{4}([-,]\\d{4})*\\s+%(author)s" + +[tool.ruff.lint.mccabe] max-complexity = 10 -[tool.ruff.pydocstyle] +[tool.ruff.lint.pydocstyle] convention = "google" +# Type checking tools configuration [tool.mypy] pretty = true python_version = "3.10" diff --git a/tox.ini b/tox.ini index 13df223..aebcc21 100644 --- a/tox.ini +++ b/tox.ini @@ -28,16 +28,17 @@ deps = pre-commit mypy types-PyYAML + -r{toxinidir}/fmt-requirements.txt + -r{toxinidir}/lint-requirements.txt commands = pre-commit install -t commit-msg [testenv:fmt] -description = Apply coding style standards to code +description = Apply coding style standards deps = -r{toxinidir}/fmt-requirements.txt commands = - black {[vars]all_path} - ruff --fix {[vars]all_path} + ruff format {[vars]all_path} [testenv:lint] description = Check code against coding style standards @@ -54,8 +55,7 @@ commands = --skip {toxinidir}/.mypy_cache \ --skip {toxinidir}/icon.svg - ruff {[vars]all_path} - black --check --diff {[vars]all_path} + ruff check --diff {[vars]all_path} [testenv:build-prerequisites] description = Install necessary Linux packages for python dependencies