diff --git a/templates/python/code_quality/ruff/ruff.yml b/templates/python/code_quality/ruff/ruff.yml index ed4a47cf0bd6b7a2d3f7c19068eec80f4653d3d0..5856ace80892f9882cbb6b26acd0410d988790b4 100644 --- a/templates/python/code_quality/ruff/ruff.yml +++ b/templates/python/code_quality/ruff/ruff.yml @@ -1,14 +1,19 @@ +include: + - remote: 'https://api.r2devops.io/job/r/gitlab/dorianturba/r2devops_catalog/r2_metadata/python_install@latest.yaml' + ruff: - image: python:latest + extends: + - .python_install stage: code_quality + variables: + PYTHON_SETUP: "pip install ruff" script: - - python --version # Debug - - python -m venv venv --upgrade-deps || python -m venv venv # upgrade-deps is not supported before 3.9 - - source venv/bin/activate - - pip install ruff - - ruff check . + - !reference [.python_install, script] + - ruff check ${PROJECT_PATH} only: changes: - - ./**/*.py + - ${PROJECT_PATH}/**/*.py - .gitlab-ci.yml - - pyproject.toml + - ${PROJECT_PATH}/pyproject.toml + - ${PROJECT_PATH}/.ruff.toml + - ${PROJECT_PATH}/ruff.toml diff --git a/tests/ruff_project/pyproject.toml b/tests/ruff_project/pyproject.toml new file mode 100644 index 0000000000000000000000000000000000000000..cea87f6e7d8f9c6ab4814f8e8a3f3f14bf9604d6 --- /dev/null +++ b/tests/ruff_project/pyproject.toml @@ -0,0 +1,11 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "ruff_project" +version = "0.1.0" +authors = [ + { name = "Author Name", email = "author.name@example.com" }, +] +description = "A description of what the package is for." diff --git a/tests/ruff_project/src/ruff_project/__init__.py b/tests/ruff_project/src/ruff_project/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..58505af1f84165e36769758d2fe06f4cdc2b1a0e --- /dev/null +++ b/tests/ruff_project/src/ruff_project/__init__.py @@ -0,0 +1,3 @@ +from flake8_project.main import main + +__all__ = ['main'] diff --git a/tests/ruff_project/src/ruff_project/main.py b/tests/ruff_project/src/ruff_project/main.py new file mode 100644 index 0000000000000000000000000000000000000000..28caf00b6f3b52955a2bc069b315fe44940eabb8 --- /dev/null +++ b/tests/ruff_project/src/ruff_project/main.py @@ -0,0 +1,11 @@ +"""Sample main module.""" + + +def main() -> bool: + """Sample main function.""" + print("Hello, world!") + return True + + +if __name__ == '__main__': + main()