mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 12:37:00 +01:00
less lint more bark, ruff ruff (#1341)
This commit is contained in:
parent
00cf5f4e15
commit
421344c347
6
.github/workflows/pykanidm_pylint.yml
vendored
6
.github/workflows/pykanidm_pylint.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
name: pykanidm - pylint
|
name: pykanidm - Python Linting
|
||||||
|
|
||||||
"on":
|
"on":
|
||||||
push:
|
push:
|
||||||
|
@ -8,7 +8,7 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
jobs:
|
jobs:
|
||||||
pykanidm_pylint:
|
pykanidm_lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -26,4 +26,4 @@ jobs:
|
||||||
cd pykanidm
|
cd pykanidm
|
||||||
python -m pip install --quiet --no-cache-dir --upgrade poetry
|
python -m pip install --quiet --no-cache-dir --upgrade poetry
|
||||||
poetry install
|
poetry install
|
||||||
poetry run pylint tests kanidm
|
poetry run ruff tests kanidm
|
||||||
|
|
16
Makefile
16
Makefile
|
@ -108,7 +108,7 @@ vendor-prep: vendor
|
||||||
tar -cJf vendor.tar.xz vendor
|
tar -cJf vendor.tar.xz vendor
|
||||||
|
|
||||||
.PHONY: install-tools
|
.PHONY: install-tools
|
||||||
install-tools: ## install tools in local environment
|
install-tools: ## install kanidm_tools in your local environment
|
||||||
install-tools:
|
install-tools:
|
||||||
cd kanidm_tools && cargo install --path . --force
|
cd kanidm_tools && cargo install --path . --force
|
||||||
|
|
||||||
|
@ -127,27 +127,27 @@ codespell:
|
||||||
--skip='./kanidmd/lib/src/constants/system_config.rs,./pykanidm/site,./kanidmd/lib/src/constants/*.json'
|
--skip='./kanidmd/lib/src/constants/system_config.rs,./pykanidm/site,./kanidmd/lib/src/constants/*.json'
|
||||||
|
|
||||||
.PHONY: test/pykanidm/pytest
|
.PHONY: test/pykanidm/pytest
|
||||||
test/pykanidm/pytest:
|
test/pykanidm/pytest: ## python library testing
|
||||||
cd pykanidm && \
|
cd pykanidm && \
|
||||||
poetry install && \
|
poetry install && \
|
||||||
poetry run pytest -vv
|
poetry run pytest -vv
|
||||||
|
|
||||||
.PHONY: test/pykanidm/pylint
|
.PHONY: test/pykanidm/lint
|
||||||
test/pykanidm/pylint:
|
test/pykanidm/lint: ## python library linting
|
||||||
cd pykanidm && \
|
cd pykanidm && \
|
||||||
poetry install && \
|
poetry install && \
|
||||||
poetry run pylint tests kanidm
|
poetry run ruff tests kanidm
|
||||||
|
|
||||||
.PHONY: test/pykanidm/mypy
|
.PHONY: test/pykanidm/mypy
|
||||||
test/pykanidm/mypy:
|
test/pykanidm/mypy: ## python library type checking
|
||||||
cd pykanidm && \
|
cd pykanidm && \
|
||||||
poetry install && \
|
poetry install && \
|
||||||
echo "Running mypy" && \
|
echo "Running mypy" && \
|
||||||
poetry run mypy --strict tests kanidm
|
poetry run mypy --strict tests kanidm
|
||||||
|
|
||||||
.PHONY: test/pykanidm
|
.PHONY: test/pykanidm
|
||||||
test/pykanidm: ## run the test suite (mypy/pylint/pytest) for the kanidm python module
|
test/pykanidm: ## run the kanidm python module test suite (mypy/lint/pytest)
|
||||||
test/pykanidm: test/pykanidm/pytest test/pykanidm/mypy test/pykanidm/pylint
|
test/pykanidm: test/pykanidm/pytest test/pykanidm/mypy test/pykanidm/lint
|
||||||
|
|
||||||
.PHONY: test/doc/format
|
.PHONY: test/doc/format
|
||||||
test/doc/format: ## Format docs and the Kanidm book
|
test/doc/format: ## Format docs and the Kanidm book
|
||||||
|
|
2
kanidm_rlm_python/pyproject.toml
Normal file
2
kanidm_rlm_python/pyproject.toml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 150
|
971
pykanidm/poetry.lock
generated
971
pykanidm/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -37,7 +37,6 @@ aiohttp = "^3.8.1"
|
||||||
Authlib = "^1.1.0"
|
Authlib = "^1.1.0"
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pylint = "^2.15.10"
|
|
||||||
mypy = "^0.991"
|
mypy = "^0.991"
|
||||||
pytest = "^7.2.1"
|
pytest = "^7.2.1"
|
||||||
types-toml = "^0.10.8"
|
types-toml = "^0.10.8"
|
||||||
|
@ -54,6 +53,9 @@ mkdocstrings = "^0.19.1"
|
||||||
mkdocstrings-python = "^0.8.3"
|
mkdocstrings-python = "^0.8.3"
|
||||||
pook = "^1.1.1"
|
pook = "^1.1.1"
|
||||||
|
|
||||||
|
[tool.poetry.group.dev.dependencies]
|
||||||
|
ruff = "^0.0.230"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
@ -65,6 +67,15 @@ extension-pkg-whitelist="pydantic"
|
||||||
# https://github.com/samuelcolvin/pydantic/issues/1961#issuecomment-759522422
|
# https://github.com/samuelcolvin/pydantic/issues/1961#issuecomment-759522422
|
||||||
load-plugins="pylint_pydantic,pylint_pytest"
|
load-plugins="pylint_pydantic,pylint_pytest"
|
||||||
|
|
||||||
|
[tool.ruff]
|
||||||
|
line-length = 150
|
||||||
|
|
||||||
|
[tool.ruff.per-file-ignores]
|
||||||
|
"tests/*.py" = [
|
||||||
|
"F401", # unused import, reused fixtures across all tests
|
||||||
|
"F811", # pytest fixtures
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
|
|
|
@ -6,8 +6,8 @@ import pytest
|
||||||
|
|
||||||
from kanidm.tokens import JWS, TokenStore
|
from kanidm.tokens import JWS, TokenStore
|
||||||
|
|
||||||
# pylint: disable=line-too-long
|
|
||||||
TEST_TOKEN = "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Im1KQTgtTURfeFRxQXBmSU9nbFptNXJ6RWhoQ3hDdjRxZFNpeGxjV1Q3ZmsiLCJ5IjoiNy0yVkNuY0h3NEF1WVJpYVpYT2FoVXRGMUE2SDd3eUxrUW1FekduS0pKcyIsImFsZyI6IkVTMjU2IiwidXNlIjoic2lnIn0sInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiZjExOTg2NzMtNGI5MC00NjE4LWJkZTctMTBiY2M2YzhjOGE0IiwiYXV0aF90eXBlIjoiZ2VuZXJhdGVkcGFzc3dvcmQiLCJleHBpcnkiOlsyMDIyLDI2NSwyODM2Niw4MDI1MjUwMDBdLCJ1dWlkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDE4IiwibmFtZSI6ImlkbV9hZG1pbiIsImRpc3BsYXluYW1lIjoiSURNIEFkbWluaXN0cmF0b3IiLCJzcG4iOiJpZG1fYWRtaW5AbG9jYWxob3N0IiwibWFpbF9wcmltYXJ5IjpudWxsLCJsaW1fdWlkeCI6ZmFsc2UsImxpbV9ybWF4IjoxMjgsImxpbV9wbWF4IjoyNTYsImxpbV9mbWF4IjozMn0.cln3gRV3NdgbGqYeD26mBSHFGOaFXak2UA5umvj_Xw30dMS8ECTnJU7lvLyepRTW_VzqUJHbRatPkQ1TEuK99Q"
|
TEST_TOKEN = "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Im1KQTgtTURfeFRxQXBmSU9nbFptNXJ6RWhoQ3hDdjRxZFNpeGxjV1Q3ZmsiLCJ5IjoiNy0yVkNuY0h3NEF1WVJpYVpYT2FoVXRGMUE2SDd3eUxrUW1FekduS0pKcyIsImFsZyI6IkVTMjU2IiwidXNlIjoic2lnIn0sInR5cCI6IkpXVCJ9.eyJzZXNzaW9uX2lkIjoiZjExOTg2NzMtNGI5MC00NjE4LWJkZTctMTBiY2M2YzhjOGE0IiwiYXV0aF90eXBlIjoiZ2VuZXJhdGVkcGFzc3dvcmQiLCJleHBpcnkiOlsyMDIyLDI2NSwyODM2Niw4MDI1MjUwMDBdLCJ1dWlkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDE4IiwibmFtZSI6ImlkbV9hZG1pbiIsImRpc3BsYXluYW1lIjoiSURNIEFkbWluaXN0cmF0b3IiLCJzcG4iOiJpZG1fYWRtaW5AbG9jYWxob3N0IiwibWFpbF9wcmltYXJ5IjpudWxsLCJsaW1fdWlkeCI6ZmFsc2UsImxpbV9ybWF4IjoxMjgsImxpbV9wbWF4IjoyNTYsImxpbV9mbWF4IjozMn0.cln3gRV3NdgbGqYeD26mBSHFGOaFXak2UA5umvj_Xw30dMS8ECTnJU7lvLyepRTW_VzqUJHbRatPkQ1TEuK99Q" # noqa: E501 pylint: disable=line-too-long
|
||||||
|
|
||||||
|
|
||||||
def test_jws_parser() -> None:
|
def test_jws_parser() -> None:
|
||||||
|
@ -52,7 +52,7 @@ def test_tokenstuff() -> None:
|
||||||
token_store = TokenStore()
|
token_store = TokenStore()
|
||||||
token_store[
|
token_store[
|
||||||
"idm_admin"
|
"idm_admin"
|
||||||
] = "eyJhbGciOiJFUzI1NiIsImp3ayI6eyJrdHkiOiJFQyIsImNydiI6IlAtMjU2IiwieCI6Im1KQTgtTURfeFRxQXBmSU9nbFptNXJ6RWhoQ3hDdjRxZFNpeGxjV1Q3ZmsiLCJ5IjoiNy0yVkNuY0h3NEF1WVJpYVpYT2FoVXRGMUE2SDd3eUxrUW1FekduS0pKcyIsImFsZyI6IkVTMjU2IiwidXNlIjoic2lnIn0sInR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pc3BsYXluYW1lIjoiSURNIEFkbWluaXN0cmF0b3IiLCJzcG4iOiJpZG1fYWRtaW5AbG9jYWxob3N0IiwibWFpbF9wcmltYXJ5IjpudWxsLCJsaW1fdWlkeCI6ZmFsc2UsImxpbV9ybWF4IjoxMjgsImxpbV9wbWF4IjoyNTYsImxpbV9mbWF4IjozMn0.rq1y7YNS9iCBWMmAu-FSa4-o4jrSSnMO_18zafgvLRtZFlB7j-Q68CzxceNN9C_1EWnc9uf4fOyeaSNUwGyaIQ" # noqa: E501 pylint: disable=line-too-long
|
||||||
|
|
||||||
info = token_store.token_info("idm_admin")
|
info = token_store.token_info("idm_admin")
|
||||||
print(f"Parsed token: {info}")
|
print(f"Parsed token: {info}")
|
||||||
|
|
Loading…
Reference in a new issue