forked from nf-core/tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nf-core#2620 from mirpedrol/add-ruff
Add ruff - Replace Black, isort and pyupgrade
- Loading branch information
Showing
93 changed files
with
509 additions
and
545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,21 +34,19 @@ jobs: | |
- name: Run 'prettier --write' | ||
run: prettier --write ${GITHUB_WORKSPACE} | ||
|
||
- name: Run Black | ||
uses: psf/black@stable | ||
with: | ||
# Override to remove the default --check flag so that we make changes | ||
options: "--color" | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: python-isort | ||
uses: isort/[email protected] | ||
with: | ||
isortVersion: "latest" | ||
requirementsFiles: "requirements.txt requirements-dev.txt" | ||
|
||
- name: Install Ruff | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff | ||
- name: Run Ruff | ||
run: | | ||
ruff check --fix . | ||
ruff format . | ||
- name: Commit & push changes | ||
run: | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,52 +44,48 @@ jobs: | |
- name: Run Prettier --check | ||
run: prettier --check ${GITHUB_WORKSPACE} | ||
|
||
PythonBlack: | ||
Ruff: | ||
runs-on: ["self-hosted"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Check out source-code repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: Install Ruff | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff | ||
- name: Run Ruff check | ||
run: ruff check . | ||
|
||
- name: Check code lints with Black | ||
uses: psf/black@stable | ||
- name: Run Ruff format | ||
run: ruff format . | ||
|
||
# If the above check failed, post a comment on the PR explaining the failure | ||
- name: Post PR comment | ||
if: failure() | ||
uses: mshick/add-pr-comment@v1 | ||
with: | ||
message: | | ||
## Python linting (`black`) is failing | ||
## Python linting (`ruff`) is failing | ||
To keep the code consistent with lots of contributors, we run automated code consistency checks. | ||
To fix this CI test, please run: | ||
* Install [`black`](https://black.readthedocs.io/en/stable/): `pip install black` | ||
* Fix formatting errors in your pipeline: `black .` | ||
* Install [`ruff`](https://github.com/astral-sh/ruff): `pip install ruff` | ||
* Fix formatting errors in your pipeline: `ruff check --fix .` and `ruff format .` | ||
Once you push these changes the test should pass, and you can hide this comment :+1: | ||
We highly recommend setting up Black in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help! | ||
We highly recommend setting up Ruff in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help! | ||
Thanks again for your contribution! | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
allow-repeats: false | ||
|
||
isort: | ||
runs-on: ["self-hosted"] | ||
steps: | ||
- name: Check out source-code repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
- name: python-isort | ||
uses: isort/[email protected] | ||
with: | ||
isortVersion: "latest" | ||
requirementsFiles: "requirements.txt requirements-dev.txt" | ||
|
||
static-type-check: | ||
runs-on: ["self-hosted"] | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.