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

Lint TODO - ignore editor files #689

Merged
merged 2 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ ENV/

# backup files
*~
*?
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ making a pull-request. See [`.github/CONTRIBUTING.md`](.github/CONTRIBUTING.md)
* Fail if `params.input` isn't defined.
* Beautiful new progress bar to look at whilst linting is running and awesome new formatted output on the command line :heart_eyes:
* All made using the excellent [`rich` python library](https://github.com/willmcgugan/rich) - check it out!
* Tests looking for `TODO` strings should now ignore editor backup files. [#477](https://github.com/nf-core/tools/issues/477)

### nf-core/tools Continuous Integration

Expand Down
13 changes: 6 additions & 7 deletions nf_core/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
the nf-core community guidelines.
"""

from rich.console import Console
from rich.markdown import Markdown
from rich.table import Table
import datetime
import fnmatch
import git
import io
import json
Expand All @@ -14,10 +18,7 @@
import re
import requests
import rich
from rich.console import Console
from rich.markdown import Markdown
import rich.progress
from rich.table import Table
import subprocess
import textwrap

Expand Down Expand Up @@ -1155,10 +1156,8 @@ def check_pipeline_todos(self):
for root, dirs, files in os.walk(self.path):
# Ignore files
for i in ignore:
if i in dirs:
dirs.remove(i)
if i in files:
files.remove(i)
dirs = [d for d in dirs if not fnmatch.fnmatch(os.path.join(root, d), i)]
files = [f for f in files if not fnmatch.fnmatch(os.path.join(root, f), i)]
for fname in files:
with io.open(os.path.join(root, fname), "rt", encoding="latin1") as fh:
for l in fh:
Expand Down