diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..70fc30a --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +extend-ignore = E203,E501,W503 +max-line-length = 99 diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 7c02822..0000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Lint -on: pull_request - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: psf/black@stable - with: - options: "--check --verbose --line-length 99" - src: "./src" - version: "~= 24.0" diff --git a/.github/workflows/isort.yml b/.github/workflows/isort.yml deleted file mode 100644 index 2ef4557..0000000 --- a/.github/workflows/isort.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Run isort -on: pull_request - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - uses: isort/isort-action@master - with: - configuration: "--check-only --diff --profile black" - requirementsFiles: "requirements.txt requirements-test.txt" diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 0000000..f34ebe8 --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,32 @@ +name: Linters + +on: + push: + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10"] + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 black isort + - name: Flake8 Lint + run: | + flake8 --ignore=E501,W503,E203 + - name: Black Lint + run: | + black --line-length 99 --check --verbose + - name: isort Lint + run: | + isort --profile black --check-only --diff diff --git a/.gitignore b/.gitignore index 79cb0cf..da9fde3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ .vscode/ -.flake8 # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/README.md b/README.md index b0f37ab..0cca7ba 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,15 @@ This repository contains plug-in tests for use during validation of submissions. ### Branches - Make new feature branches from `devel`. -- Before submitting a PR, make sure your code is black and isort compliant. Run the following from the base `ingest-validation-tests` directory: +- Before submitting a PR, make sure your code is black, isort, and flake8 compliant. Run the following from the base `ingest-validation-tests` directory: ``` black --line-length 99 . isort --profile black --multi-line 3 . + flake8 ``` - (You can integrate black and potentially isort with your editor to skip this step, see Setup section below) + (Integrating black and potentially isort/flake8 with your editor may allow you to skip this step, see Setup section below.) - Make PRs to `devel`. (This is the default branch.) - The last reviewer to approve a PR should merge it. @@ -32,6 +33,7 @@ This repository contains plug-in tests for use during validation of submissions. - (optional) Integrate black with your editor. - [Instructions for black.](https://black.readthedocs.io/en/stable/integrations/editors.html) - (optional) Integrate [isort](https://pycqa.github.io/isort/) with your editor. +- (optional) Integrate [flake8](https://flake8.pycqa.org/en/latest/index.html) with your editor. ### Testing diff --git a/requirements-dev.txt b/requirements-dev.txt index 2cd9d49..ba6f71b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ black==23.12.1 +flake8==7.0.0 git+https://github.com/hubmapconsortium/fastq-utils.git@v0.2.5#egg=hubmap-fastq-utils imagecodecs>=2023.3.16 isort==5.13.2