Skip to content

Commit

Permalink
Adding linting check to python code (#1272)
Browse files Browse the repository at this point in the history
* Adding linting to backend check

* Adding .git-blame-ignore-revs

* Updating .git-blame-ignore-revs
  • Loading branch information
manasaV3 committed Sep 29, 2023
1 parent 22bd0d8 commit 41ae700
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .git-blame-ignore-revs
@@ -0,0 +1,4 @@
# Migrate nhcommons code style to Black
a3c4aa2bdb8cc46113bcc3d3743435e6f323a052
# Fixing formatting with black for backend, data-workflow, plugin
192d5f44bab1cf4defa4dc152fde3dc9e25dfac9
23 changes: 22 additions & 1 deletion .github/workflows/backend-tests.yml
Expand Up @@ -9,12 +9,14 @@ on:
paths:
- 'backend/**'
- 'napari-hub-commons/**'
- '.github/workflows/backend-tests.yml'
pull_request:
branches:
- '**'
paths:
- 'backend/**'
- 'napari-hub-commons/**'
- '.github/workflows/backend-tests.yml'

defaults:
run:
Expand All @@ -23,7 +25,7 @@ defaults:
jobs:
# Runs pytest for backend code
tests:
name: pytest
name: Unit test with pytest
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -53,3 +55,22 @@ jobs:
working-directory: backend
run : |
python -m pytest utils api
lints:
name: Linting with Black
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"

- uses: psf/black@stable
with:
options: "--check --diff --color --verbose"
version: "~= 23.1.0"
src: "./backend"
23 changes: 22 additions & 1 deletion .github/workflows/dataworkflow-tests.yml
Expand Up @@ -9,12 +9,14 @@ on:
paths:
- 'data-workflows/**'
- 'napari-hub-commons/**'
- '.github/workflows/dataworkflow-tests.yml'
pull_request:
branches:
- '**'
paths:
- 'data-workflows/**'
- 'napari-hub-commons/**'
- '.github/workflows/dataworkflow-tests.yml'

defaults:
run:
Expand All @@ -23,7 +25,7 @@ defaults:
jobs:
# Runs pytest for data-workflows code
tests:
name: pytest
name: Unit test with pytest
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -51,3 +53,22 @@ jobs:
- name: Run unit tests
working-directory: data-workflows
run : python -m pytest

lints:
name: Linting with Black
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"

- uses: psf/black@stable
with:
options: "--check --diff --color --verbose"
version: "~= 23.1.0"
src: "./data-workflows"
23 changes: 22 additions & 1 deletion .github/workflows/nh-commons-tests.yml
Expand Up @@ -8,11 +8,13 @@ on:
- main
paths:
- 'napari-hub-commons/**'
- '.github/workflows/nh-commons-tests.yml'
pull_request:
branches:
- '**'
paths:
- 'napari-hub-commons/**'
- '.github/workflows/nh-commons-tests.yml'

defaults:
run:
Expand All @@ -21,7 +23,7 @@ defaults:
jobs:
# Runs pytest for napari-hub-commons code
tests:
name: pytest
name: Unit test with pytest
runs-on: ubuntu-20.04

steps:
Expand Down Expand Up @@ -49,3 +51,22 @@ jobs:
- name: Run unit tests
working-directory: napari-hub-commons
run : python -m pytest

lints:
name: Linting with Black
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"

- uses: psf/black@stable
with:
options: "--check --diff --color --verbose"
version: "~= 23.1.0"
src: "./napari-hub-commons"
23 changes: 22 additions & 1 deletion .github/workflows/plugins-tests.yml
Expand Up @@ -9,12 +9,14 @@ on:
paths:
- 'plugins/**'
- 'napari-hub-commons/**'
- '.github/workflows/plugins-tests.yml'
pull_request:
branches:
- '**'
paths:
- 'plugins/**'
- 'napari-hub-commons/**'
- '.github/workflows/plugins-tests.yml'

defaults:
run:
Expand All @@ -23,7 +25,7 @@ defaults:
jobs:
# Runs pytest for backend code
tests:
name: pytest
name: Unit test with pytest
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -54,3 +56,22 @@ jobs:
working-directory: plugins/
run : |
python -m pytest .
lints:
name: Linting with Black
runs-on: ubuntu-20.04

steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.9"

- uses: psf/black@stable
with:
options: "--check --diff --color --verbose"
version: "~= 23.1.0"
src: "./plugins"

0 comments on commit 41ae700

Please sign in to comment.