Skip to content
Snippets Groups Projects
Commit f5a04ff0 authored by Roang's avatar Roang
Browse files

Add ruff to tox and ci

parent eb9d409c
Branches
Tags
No related merge requests found
...@@ -118,8 +118,19 @@ code_style: ...@@ -118,8 +118,19 @@ code_style:
- meta_build - meta_build
script: script:
- python3 -V - python3 -V
- cd src - tox run
- tox run -e flake8 allow_failure: true
rules:
- when: always
ruff:
image: $CI_REGISTRY_IMAGE/build_image:latest
stage: test
needs:
- meta_build
script:
- python3 -V
- tox run -e ruff
allow_failure: true allow_failure: true
rules: rules:
- when: always - when: always
......
extend = ".ruff.toml" extend = "src/.ruff.extended.toml"
extend-select = [
"A",
"ARG",
"B",
"COM",
"DJ",
"EM",
"ERA",
"FBT",
"FIX",
"I",
"INP",
"N",
"PL",
"Q",
"RET",
"RSE",
"RUF",
"SIM",
"TD",
"TRY",
"UP","BLE","S",
]
ignore = ["TID252", "TD002", "RUF012", "RUF100", "PLR091", "PLR2004"]
line-length = 160 extend = "src/.ruff.toml"
extend-exclude = ["venv", ".tox", "migrations"]
extend-select = [
"C4",
"DTZ",
"E",
"F",
"G",
"I002",
"INT",
"ISC",
"PGH",
"PIE",
"PTH",
"RUF",
"T20",
"TID",
"W",
"T10",
]
ignore = ["ISC001", "TID252", "TD002", "RUF012", "RUF100", "PLR091", "PLR2004"]
[format]
# Use single quotes for non-triple-quoted strings.
quote-style = "single"
[flake8-quotes]
inline-quotes = "single"
[flake8-unused-arguments]
ignore-variadic-names = true
[isort]
section-order = [
"future",
"standard-library",
"third-party",
"django",
"first-party",
"hub",
"local-apps",
"local-folder",
]
[isort.sections]
# Group all Django imports into a separate section.
"hub" = ["hub", "core"]
"local-apps" = ["backoffice", "api", "plainui"]
"django" = [
"django-cors-headers",
"django-cors-middleware",
"django-debug-toolbar",
"django-environ",
"django-modeltranslation",
"django-oauth-toolkit",
"django-ratelimit",
"django-redis",
"django-storages",
"django-widget-tweaks",
"django_bootstrap5",
"djangorestframework",
]
extend = ".ruff.toml"
extend-select = [
"A",
"ARG",
"B",
"COM",
"DJ",
"EM",
"ERA",
"FBT",
"FIX",
"I",
"INP",
"N",
"PL",
"Q",
"RET",
"RSE",
"RUF",
"SIM",
"TD",
"TRY",
"UP","BLE","S",
]
ignore = ["TID252", "TD002", "RUF012", "RUF100", "PLR091", "PLR2004"]
line-length = 160
extend-exclude = ["venv", ".tox", "migrations"]
extend-select = [
"C4",
"DTZ",
"E",
"F",
"G",
"I002",
"INT",
"ISC",
"PGH",
"PIE",
"PTH",
"RUF",
"T20",
"TID",
"W",
"T10",
]
ignore = ["ISC001", "TID252", "TD002", "RUF012", "RUF100", "PLR091", "PLR2004"]
[format]
# Use single quotes for non-triple-quoted strings.
quote-style = "single"
[flake8-quotes]
inline-quotes = "single"
[flake8-unused-arguments]
ignore-variadic-names = true
[isort]
section-order = [
"future",
"standard-library",
"third-party",
"django",
"first-party",
"hub",
"local-apps",
"local-folder",
]
[isort.sections]
# Group all Django imports into a separate section.
"hub" = ["hub", "core"]
"local-apps" = ["backoffice", "api", "plainui"]
"django" = [
"django-cors-headers",
"django-cors-middleware",
"django-debug-toolbar",
"django-environ",
"django-modeltranslation",
"django-oauth-toolkit",
"django-ratelimit",
"django-redis",
"django-storages",
"django-widget-tweaks",
"django_bootstrap5",
"djangorestframework",
]
extend = "../../../../.ruff.toml" extend = "../../../.ruff.toml"
ignore = ["T201"] ignore = ["T201"]
extend = "../../../.ruff.toml" extend = "../../.ruff.toml"
ignore = ["T201"] ignore = ["T201"]
flake8 ~= 6.1.0
tox ~= 4.11.3
coverage ~= 7.3.2 coverage ~= 7.3.2
debugpy ~= 1.8.0 debugpy ~= 1.8.0
flake8 ~= 6.1.0
ruff ~= 0.1.5
tox ~= 4.11.3
[tox] [tox]
requires = requires =
tox>=4 tox>=4
env_list = flake8, migrations, django-test env_list = flake8, ruff, migrations, django-test
[hub] [hub]
setenv= setenv=
...@@ -28,6 +28,14 @@ allowlist_externals= ...@@ -28,6 +28,14 @@ allowlist_externals=
commands = commands =
flake8 . flake8 .
[testenv:ruff]
skip_install = true
sitepackages = true
allowlist_externals=
ruff
commands =
ruff .
[testenv:app_version] [testenv:app_version]
system_site_packages = true system_site_packages = true
setenv = setenv =
......
[tox]
requires =
tox>=4
env_list = ruff
[testenv:ruff]
skip_install = true
sitepackages = true
allowlist_externals=
ruff
commands =
ruff .
[flake8] [flake8]
max-line-length = 160 max-line-length = 160
per-file-ignores = per-file-ignores =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment