Skip to content
Snippets Groups Projects
Commit 5e323fbe authored by nservant's avatar nservant
Browse files

[TOOLS] lint --fix files_unchanged

parent 199b7874
No related branches found
No related tags found
No related merge requests found
*.config linguist-language=nextflow *.config linguist-language=nextflow
*.nf.test linguist-language=nextflow
modules/nf-core/** linguist-generated modules/nf-core/** linguist-generated
subworkflows/nf-core/** linguist-generated subworkflows/nf-core/** linguist-generated
...@@ -101,3 +101,19 @@ If you are using a new feature from core Nextflow, you may bump the minimum requ ...@@ -101,3 +101,19 @@ If you are using a new feature from core Nextflow, you may bump the minimum requ
### Images and figures ### Images and figures
For overview images and other documents we follow the nf-core [style guidelines and examples](https://nf-co.re/developers/design_guidelines). For overview images and other documents we follow the nf-core [style guidelines and examples](https://nf-co.re/developers/design_guidelines).
## GitHub Codespaces
This repo includes a devcontainer configuration which will create a GitHub Codespaces for Nextflow development! This is an online developer environment that runs in your browser, complete with VSCode and a terminal.
To get started:
- Open the repo in [Codespaces](https://github.com/nf-core/hic/codespaces)
- Tools installed
- nf-core
- Nextflow
Devcontainer specs:
- [DevContainer config](.devcontainer/devcontainer.json)
- [Dockerfile](.devcontainer/Dockerfile)
...@@ -42,7 +42,7 @@ body: ...@@ -42,7 +42,7 @@ body:
attributes: attributes:
label: System information label: System information
description: | description: |
* Nextflow version _(eg. 21.10.3)_ * Nextflow version _(eg. 22.10.1)_
* Hardware _(eg. HPC, Desktop, Cloud)_ * Hardware _(eg. HPC, Desktop, Cloud)_
* Executor _(eg. slurm, local, awsbatch)_ * Executor _(eg. slurm, local, awsbatch)_
* Container engine: _(e.g. Docker, Singularity, Conda, Podman, Shifter or Charliecloud)_ * Container engine: _(e.g. Docker, Singularity, Conda, Podman, Shifter or Charliecloud)_
......
...@@ -15,8 +15,7 @@ Learn more about contributing: [CONTRIBUTING.md](https://github.com/nf-core/hic/ ...@@ -15,8 +15,7 @@ Learn more about contributing: [CONTRIBUTING.md](https://github.com/nf-core/hic/
- [ ] This comment contains a description of changes (with reason). - [ ] This comment contains a description of changes (with reason).
- [ ] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/nf-core/hic/tree/master/.github/CONTRIBUTING.md) - [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/nf-core/hic/tree/master/.github/CONTRIBUTING.md)- [ ] If necessary, also make a PR on the nf-core/hic _branch_ on the [nf-core/test-datasets](https://github.com/nf-core/test-datasets) repository.
- [ ] If necessary, also make a PR on the nf-core/hic _branch_ on the [nf-core/test-datasets](https://github.com/nf-core/test-datasets) repository.
- [ ] Make sure your code lints (`nf-core lint`). - [ ] Make sure your code lints (`nf-core lint`).
- [ ] Ensure the test suite passes (`nextflow run . -profile test,docker --outdir <OUTDIR>`). - [ ] Ensure the test suite passes (`nextflow run . -profile test,docker --outdir <OUTDIR>`).
- [ ] Usage Documentation in `docs/usage.md` is updated. - [ ] Usage Documentation in `docs/usage.md` is updated.
......
...@@ -4,6 +4,8 @@ name: nf-core linting ...@@ -4,6 +4,8 @@ name: nf-core linting
# that the code meets the nf-core guidelines. # that the code meets the nf-core guidelines.
on: on:
push: push:
branches:
- dev
pull_request: pull_request:
release: release:
types: [published] types: [published]
...@@ -12,9 +14,9 @@ jobs: ...@@ -12,9 +14,9 @@ jobs:
EditorConfig: EditorConfig:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
- name: Install editorconfig-checker - name: Install editorconfig-checker
run: npm install -g editorconfig-checker run: npm install -g editorconfig-checker
...@@ -25,9 +27,9 @@ jobs: ...@@ -25,9 +27,9 @@ jobs:
Prettier: Prettier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-node@v2 - uses: actions/setup-node@v3
- name: Install Prettier - name: Install Prettier
run: npm install -g prettier run: npm install -g prettier
...@@ -35,22 +37,48 @@ jobs: ...@@ -35,22 +37,48 @@ jobs:
- name: Run Prettier --check - name: Run Prettier --check
run: prettier --check ${GITHUB_WORKSPACE} run: prettier --check ${GITHUB_WORKSPACE}
PythonBlack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check code lints with Black
uses: psf/black@stable
# 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
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 .`
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!
Thanks again for your contribution!
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false
nf-core: nf-core:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out pipeline code - name: Check out pipeline code
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Install Nextflow - name: Install Nextflow
env: uses: nf-core/setup-nextflow@v1
CAPSULE_LOG: none
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- uses: actions/setup-python@v3 - uses: actions/setup-python@v4
with: with:
python-version: "3.6" python-version: "3.7"
architecture: "x64" architecture: "x64"
- name: Install dependencies - name: Install dependencies
...@@ -71,7 +99,7 @@ jobs: ...@@ -71,7 +99,7 @@ jobs:
- name: Upload linting log file artifact - name: Upload linting log file artifact
if: ${{ always() }} if: ${{ always() }}
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v3
with: with:
name: linting-logs name: linting-logs
path: | path: |
......
...@@ -18,7 +18,7 @@ jobs: ...@@ -18,7 +18,7 @@ jobs:
- name: Get PR number - name: Get PR number
id: pr_number id: pr_number
run: echo "::set-output name=pr_number::$(cat linting-logs/PR_number.txt)" run: echo "name=pr_number::$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT
- name: Post PR comment - name: Post PR comment
uses: marocchino/sticky-pull-request-comment@v2 uses: marocchino/sticky-pull-request-comment@v2
......
email_template.html email_template.html
adaptivecard.json
slackreport.json
.nextflow* .nextflow*
work/ work/
data/ data/
...@@ -7,3 +9,4 @@ results/ ...@@ -7,3 +9,4 @@ results/
testing/ testing/
testing* testing*
*.pyc *.pyc
bin/
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
`._,._,' `._,._,'
nf-core/hic v${version} nf-core/hic v${version}
---------------------------------------------------- ----------------------------------------------------
Run Name: $runName Run Name: $runName
<% if (success){ <% if (success){
......
...@@ -46,7 +46,6 @@ class NfcoreSchema { ...@@ -46,7 +46,6 @@ class NfcoreSchema {
'quiet', 'quiet',
'syslog', 'syslog',
'v', 'v',
'version',
// Options for `nextflow run` command // Options for `nextflow run` command
'ansi', 'ansi',
......
...@@ -32,6 +32,25 @@ class NfcoreTemplate { ...@@ -32,6 +32,25 @@ class NfcoreTemplate {
} }
} }
//
// Generate version string
//
public static String version(workflow) {
String version_string = ""
if (workflow.manifest.version) {
def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : ''
version_string += "${prefix_v}${workflow.manifest.version}"
}
if (workflow.commitId) {
def git_shortsha = workflow.commitId.substring(0, 7)
version_string += "-g${git_shortsha}"
}
return version_string
}
// //
// Construct and send completion email // Construct and send completion email
// //
...@@ -61,7 +80,7 @@ class NfcoreTemplate { ...@@ -61,7 +80,7 @@ class NfcoreTemplate {
misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp
def email_fields = [:] def email_fields = [:]
email_fields['version'] = workflow.manifest.version email_fields['version'] = NfcoreTemplate.version(workflow)
email_fields['runName'] = workflow.runName email_fields['runName'] = workflow.runName
email_fields['success'] = workflow.success email_fields['success'] = workflow.success
email_fields['dateComplete'] = workflow.complete email_fields['dateComplete'] = workflow.complete
...@@ -145,6 +164,64 @@ class NfcoreTemplate { ...@@ -145,6 +164,64 @@ class NfcoreTemplate {
output_tf.withWriter { w -> w << email_txt } output_tf.withWriter { w -> w << email_txt }
} }
//
// Construct and send a notification to a web server as JSON
// e.g. Microsoft Teams and Slack
//
public static void IM_notification(workflow, params, summary_params, projectDir, log) {
def hook_url = params.hook_url
def summary = [:]
for (group in summary_params.keySet()) {
summary << summary_params[group]
}
def misc_fields = [:]
misc_fields['start'] = workflow.start
misc_fields['complete'] = workflow.complete
misc_fields['scriptfile'] = workflow.scriptFile
misc_fields['scriptid'] = workflow.scriptId
if (workflow.repository) misc_fields['repository'] = workflow.repository
if (workflow.commitId) misc_fields['commitid'] = workflow.commitId
if (workflow.revision) misc_fields['revision'] = workflow.revision
misc_fields['nxf_version'] = workflow.nextflow.version
misc_fields['nxf_build'] = workflow.nextflow.build
misc_fields['nxf_timestamp'] = workflow.nextflow.timestamp
def msg_fields = [:]
msg_fields['version'] = NfcoreTemplate.version(workflow)
msg_fields['runName'] = workflow.runName
msg_fields['success'] = workflow.success
msg_fields['dateComplete'] = workflow.complete
msg_fields['duration'] = workflow.duration
msg_fields['exitStatus'] = workflow.exitStatus
msg_fields['errorMessage'] = (workflow.errorMessage ?: 'None')
msg_fields['errorReport'] = (workflow.errorReport ?: 'None')
msg_fields['commandLine'] = workflow.commandLine.replaceFirst(/ +--hook_url +[^ ]+/, "")
msg_fields['projectDir'] = workflow.projectDir
msg_fields['summary'] = summary << misc_fields
// Render the JSON template
def engine = new groovy.text.GStringTemplateEngine()
// Different JSON depending on the service provider
// Defaults to "Adaptive Cards" (https://adaptivecards.io), except Slack which has its own format
def json_path = hook_url.contains("hooks.slack.com") ? "slackreport.json" : "adaptivecard.json"
def hf = new File("$projectDir/assets/${json_path}")
def json_template = engine.createTemplate(hf).make(msg_fields)
def json_message = json_template.toString()
// POST
def post = new URL(hook_url).openConnection();
post.setRequestMethod("POST")
post.setDoOutput(true)
post.setRequestProperty("Content-Type", "application/json")
post.getOutputStream().write(json_message.getBytes("UTF-8"));
def postRC = post.getResponseCode();
if (! postRC.equals(200)) {
log.warn(post.getErrorStream().getText());
}
}
// //
// Print pipeline summary on completion // Print pipeline summary on completion
// //
...@@ -154,7 +231,7 @@ class NfcoreTemplate { ...@@ -154,7 +231,7 @@ class NfcoreTemplate {
if (workflow.stats.ignoredCount == 0) { if (workflow.stats.ignoredCount == 0) {
log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-" log.info "-${colors.purple}[$workflow.manifest.name]${colors.green} Pipeline completed successfully${colors.reset}-"
} else { } else {
log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed successfully, but with errored process(es) ${colors.reset}-" log.info "-${colors.purple}[$workflow.manifest.name]${colors.yellow} Pipeline completed successfully, but with errored process(es) ${colors.reset}-"
} }
} else { } else {
log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-" log.info "-${colors.purple}[$workflow.manifest.name]${colors.red} Pipeline completed with errors${colors.reset}-"
...@@ -242,6 +319,7 @@ class NfcoreTemplate { ...@@ -242,6 +319,7 @@ class NfcoreTemplate {
// //
public static String logo(workflow, monochrome_logs) { public static String logo(workflow, monochrome_logs) {
Map colors = logColours(monochrome_logs) Map colors = logColours(monochrome_logs)
String workflow_version = NfcoreTemplate.version(workflow)
String.format( String.format(
"""\n """\n
${dashedLine(monochrome_logs)} ${dashedLine(monochrome_logs)}
...@@ -250,7 +328,7 @@ class NfcoreTemplate { ...@@ -250,7 +328,7 @@ class NfcoreTemplate {
${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} ${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset}
${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} ${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset}
${colors.green}`._,._,\'${colors.reset} ${colors.green}`._,._,\'${colors.reset}
${colors.purple} ${workflow.manifest.name} v${workflow.manifest.version}${colors.reset} ${colors.purple} ${workflow.manifest.name} ${workflow_version}${colors.reset}
${dashedLine(monochrome_logs)} ${dashedLine(monochrome_logs)}
""".stripIndent() """.stripIndent()
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment