From f360081d3c1ea462524e6484a0ed921c33d5058c Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:43:11 +0100 Subject: [PATCH 1/4] ci: rename lint job and added ruff action step --- .github/workflows/lint.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dae17580..3f221c26 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - black: + python: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -21,3 +21,7 @@ jobs: - uses: psf/black@stable with: src: ${{ steps.changed-files.outputs.all_changed_files }} + + - uses: chartboost/ruff-action@v1 + with: + src: ${{ steps.changed-files.outputs.all_changed_files }} From 1abdd38fee3d7757a694bb4ae676152d1e5884ce Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Wed, 10 Jan 2024 16:51:10 +0100 Subject: [PATCH 2/4] ci: check if changed files empty --- .github/workflows/lint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3f221c26..fefe85bf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -18,10 +18,12 @@ jobs: with: files: "**/*.py" - - uses: psf/black@stable + - if: ${{ steps.changed-files.outputs.all_changed_files != '' }} + uses: psf/black@stable with: src: ${{ steps.changed-files.outputs.all_changed_files }} - - uses: chartboost/ruff-action@v1 + - if: ${{ steps.changed-files.outputs.all_changed_files != '' }} + uses: chartboost/ruff-action@v1 with: src: ${{ steps.changed-files.outputs.all_changed_files }} From 3bc976b75af9a8ef0eaba47371b1b2b6233cfd4a Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:00:51 +0100 Subject: [PATCH 3/4] docs: added ruff and black ref to contributing section --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ce32c493..1780b2fd 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,7 @@ Any contribution is welcome and we only ask contributors to: * Provide *at least* integration tests for any contribution. * The Pull Request *MUST* contain a changelog fragment. See [Ansible documentation](https://docs.ansible.com/ansible/latest/community/development_process.html#creating-a-changelog-fragment) about fragments. * Create an issue for any significant contribution that would change a large portion of the code base. +* Use [ruff](https://github.com/astral-sh/ruff) to lint and [black](https://github.com/psf/black) to format your changes on python code. ## Contributors ✨ From 9706acaf7edf386e70fd8b85757076bd013cb487 Mon Sep 17 00:00:00 2001 From: Nemental <15136847+Nemental@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:01:47 +0100 Subject: [PATCH 4/4] chore: changelog fragment --- changelogs/fragments/341-lint-ruff.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelogs/fragments/341-lint-ruff.yml diff --git a/changelogs/fragments/341-lint-ruff.yml b/changelogs/fragments/341-lint-ruff.yml new file mode 100644 index 00000000..e5cfd5b4 --- /dev/null +++ b/changelogs/fragments/341-lint-ruff.yml @@ -0,0 +1,3 @@ +--- +trivial: + - added python ruff linting action