Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add editorconfig linting to tools CI tests #1476

Merged
merged 10 commits into from
Mar 18, 2022
9 changes: 8 additions & 1 deletion .github/workflows/create-lint-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,16 @@ jobs:
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/

# Install the Prettier linting stuff
# Install the Prettier linting tools
- uses: actions/setup-node@v2

- name: Install Prettier
run: npm install -g prettier

# Install the editorconfig linting tools
- name: Install editorconfig-checker
run: npm install -g editorconfig-checker

# Build a pipeline from the template
- name: nf-core create
run: nf-core --log-file log.txt create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface"
Expand All @@ -69,6 +73,9 @@ jobs:
- name: Run Prettier --check
run: prettier --check nf-core-testpipeline

- name: Run ECLint check
run: editorconfig-checker -exclude README.md $(find nf-core-testpipeline/.* -type f | grep -v '.git\|.py\|md\|json\|yml\|yaml\|html\|css\|work\|.nextflow\|build\|nf_core.egg-info\|log.txt\|Makefile')

# Update modules to the latest version
- name: nf-core modules update
run: nf-core --log-file log.txt modules update --dir nf-core-testpipeline --all --no-preview
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ name: Lint tools code formatting
on: [push, pull_request]

jobs:
EditorConfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2

- name: Install editorconfig-checker
run: npm install -g editorconfig-checker

# Run editor config check only on files not covered by a linter
- name: Run ECLint check
run: editorconfig-checker -exclude README.md $(git ls-files | grep -v 'test\|.py\|md\|json\|yml\|yaml\|html\|css\|Makefile')

Prettier:
runs-on: ubuntu-latest
steps:
Expand Down
20 changes: 10 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:3.8.9-slim
FROM python:3.8.9-slim
LABEL authors="phil.ewels@scilifelab.se,erik.danielsson@scilifelab.se" \
description="Docker image containing requirements for the nfcore tools"
description="Docker image containing requirements for the nfcore tools"

# Do not pick up python packages from $HOME
ENV PYTHONNUSERSITE=1
Expand All @@ -14,23 +14,23 @@ RUN python -m pip install -r requirements.txt

# Install Nextflow dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y git \
&& apt-get install -y curl
&& apt-get upgrade -y \
&& apt-get install -y git \
&& apt-get install -y curl

# Create man dir required for Java installation
# Create man dir required for Java installation
# and install Java
RUN mkdir -p /usr/share/man/man1 \
&& apt-get install -y openjdk-11-jre \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
&& apt-get install -y openjdk-11-jre \
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*

# Setup ARG for NXF_VER ENV
ARG NXF_VER=""
ENV NXF_VER ${NXF_VER}
# Install Nextflow
RUN curl -s https://get.nextflow.io | bash \
&& mv nextflow /usr/local/bin \
&& chmod a+rx /usr/local/bin/nextflow
&& mv nextflow /usr/local/bin \
&& chmod a+rx /usr/local/bin/nextflow
# Add the nf-core source files to the image
COPY . /usr/src/nf_core
WORKDIR /usr/src/nf_core
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include LICENSE
include README.md
graft nf_core/module-template
graft nf_core/pipeline-template
include requirements.txt
include requirements.txt
4 changes: 2 additions & 2 deletions nf_core/module-template/tests/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ include { {{ tool_name_underscore|upper }} } from '../../../{{ "../" if subtool

workflow test_{{ tool_name_underscore }} {
{% if has_meta %}
input = [
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
{%- else %}
input = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
run: npm install -g editorconfig-checker

- name: Run ECLint check
run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test)
run: editorconfig-checker -exclude README.md $(find .* -type f | grep -v '.git\|.py\|.md\|json\|yml\|yaml\|html\|css\|work\|.nextflow\|build\|nf_core.egg-info\|log.txt\|Makefile')

Prettier:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions nf_core/pipeline-template/assets/email_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

<!-- prettier-ignore -->
<meta name="description" content="{{ name }}: {{ description }}" />
<title>{{ name }} Pipeline Report</title>
</head>
Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[build-system]
build-backend = 'setuptools.build_meta'
build-backend = "setuptools.build_meta"
requires = [
'setuptools>=40.6.0',
'wheel'
"setuptools>=40.6.0",
"wheel"
]

[tool.black]
line-length = 120
target_version = ['py36','py37','py38']
target_version = ["py36","py37","py38"]

[tool.pytest.ini_options]
markers = [
"datafiles: load datafiles"
]
testpaths = ["tests"]
norecursedirs = [ '.*', 'build', 'dist', '*.egg', 'data', '__pycache__', '.github', 'nf_core', 'docs']
norecursedirs = [ ".*", "build", "dist", "*.egg", "data", "__pycache__", ".github", "nf_core", "docs"]
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ pytest-cov
mock
black
Sphinx
sphinx_rtd_theme
sphinx_rtd_theme