From d283339a00643f5857ec19a7c11ddd9c27ce8f63 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Sun, 14 Feb 2021 15:00:41 +0100 Subject: [PATCH 1/3] Added NfcoreSchema.groovy and deps to linting Files must now be present and unchanged. --- nf_core/lint/files_exist.py | 6 +++++- nf_core/lint/files_unchanged.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nf_core/lint/files_exist.py b/nf_core/lint/files_exist.py index 2f835b3aae..acffa87372 100644 --- a/nf_core/lint/files_exist.py +++ b/nf_core/lint/files_exist.py @@ -27,7 +27,9 @@ def files_exist(self): 'docs/usage.md', '.github/workflows/branch.yml', '.github/workflows/ci.yml', - '.github/workflows/linting.yml' + '.github/workflows/linting.yml', + 'lib/NfcoreSchema.groovy', + 'lib/nfcore_external_java_deps.jar' Files that *should* be present:: @@ -71,6 +73,8 @@ def files_exist(self): [os.path.join(".github", "workflows", "branch.yml")], [os.path.join(".github", "workflows", "ci.yml")], [os.path.join(".github", "workflows", "linting.yml")], + [os.path.join("lib","NfcoreSchema.groovy")], + [os.path.join("lib","nfcore_external_java_deps.jar")] ] files_warn = [ ["main.nf"], diff --git a/nf_core/lint/files_unchanged.py b/nf_core/lint/files_unchanged.py index a1ad03d3cf..41901b9020 100644 --- a/nf_core/lint/files_unchanged.py +++ b/nf_core/lint/files_unchanged.py @@ -38,7 +38,9 @@ def files_unchanged(self): 'bin/markdown_to_html.py', 'conf/charliecloud.config', 'docs/README.md', - 'docs/images/nf-core-PIPELINE_logo.png' + 'docs/images/nf-core-PIPELINE_logo.png', + 'lib/NfcoreSchema.groovy', + 'lib/nfcore_external_java_deps.jar' Files that can have additional content but must include the template contents:: @@ -97,6 +99,8 @@ def files_unchanged(self): [os.path.join("conf", "charliecloud.config")], [os.path.join("docs", "README.md")], [os.path.join("docs", "images", "nf-core-{}_logo.png".format(short_name))], + [os.path.join("lib", "NfcoreSchema.groovy")], + [os.path.join("lib", "nfcore_external_java_deps.jar")], ] files_partial = [ [".gitignore", "foo"], From 2fc14ebdc36861e62d7fbd320cbcb316c15efa37 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 16 Feb 2021 14:14:46 +0100 Subject: [PATCH 2/3] Lint messages - use markdown code backticks --- nf_core/lint/files_unchanged.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nf_core/lint/files_unchanged.py b/nf_core/lint/files_unchanged.py index 41901b9020..4f487ed072 100644 --- a/nf_core/lint/files_unchanged.py +++ b/nf_core/lint/files_unchanged.py @@ -148,15 +148,15 @@ def _tf(file_path): for f in files: try: if filecmp.cmp(_pf(f), _tf(f), shallow=True): - passed.append(f"'{f}' matches the template") + passed.append(f"`{f}` matches the template") else: if "files_unchanged" in self.fix: # Try to fix the problem by overwriting the pipeline file shutil.copy(_tf(f), _pf(f)) - passed.append(f"'{f}' matches the template") - fixed.append(f"'{f}' overwritten with template file") + passed.append(f"`{f}` matches the template") + fixed.append(f"`{f}` overwritten with template file") else: - failed.append(f"'{f}' does not match the template") + failed.append(f"`{f}` does not match the template") could_fix = True except FileNotFoundError: pass @@ -182,7 +182,7 @@ def _tf(file_path): with open(_tf(f), "r") as fh: template_file = fh.read() if template_file in pipeline_file: - passed.append(f"'{f}' matches the template") + passed.append(f"`{f}` matches the template") else: if "files_unchanged" in self.fix: # Try to fix the problem by overwriting the pipeline file @@ -190,10 +190,10 @@ def _tf(file_path): template_file = fh.read() with open(_pf(f), "w") as fh: fh.write(template_file) - passed.append(f"'{f}' matches the template") - fixed.append(f"'{f}' overwritten with template file") + passed.append(f"`{f}` matches the template") + fixed.append(f"`{f}` overwritten with template file") else: - failed.append(f"'{f}' does not match the template") + failed.append(f"`{f}` does not match the template") could_fix = True except FileNotFoundError: pass From daca4bee661db6cdfbcf894e082fe8c94ac89693 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 16 Feb 2021 14:40:26 +0100 Subject: [PATCH 3/3] Blacken code.. --- nf_core/lint/files_exist.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nf_core/lint/files_exist.py b/nf_core/lint/files_exist.py index acffa87372..c5bc3f9d23 100644 --- a/nf_core/lint/files_exist.py +++ b/nf_core/lint/files_exist.py @@ -73,8 +73,8 @@ def files_exist(self): [os.path.join(".github", "workflows", "branch.yml")], [os.path.join(".github", "workflows", "ci.yml")], [os.path.join(".github", "workflows", "linting.yml")], - [os.path.join("lib","NfcoreSchema.groovy")], - [os.path.join("lib","nfcore_external_java_deps.jar")] + [os.path.join("lib", "NfcoreSchema.groovy")], + [os.path.join("lib", "nfcore_external_java_deps.jar")], ] files_warn = [ ["main.nf"],