-
Notifications
You must be signed in to change notification settings - Fork 192
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
Refactor modules lint
#1164
Refactor modules lint
#1164
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1164 +/- ##
==========================================
- Coverage 71.56% 70.74% -0.83%
==========================================
Files 29 49 +20
Lines 3355 5233 +1878
==========================================
+ Hits 2401 3702 +1301
- Misses 954 1531 +577
Continue to review full report at Codecov.
|
nf_core/modules/lint/__init__.py
Outdated
self.lint_tests = [k for k in self.lint_tests if k in self.key] | ||
# Filter the tests by the key if one is supplied | ||
if key: | ||
self.filter_tests_by_key() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to supply the key
to the filter function here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Went back and forth between having key
as a argument and as an attribute of the class.
def filter_tests_by_key(self, key): | ||
"""Filters the tests by the supplied key""" | ||
# Check that supplied test keys exist | ||
bad_keys = [k for k in key if k not in self.lint_tests] | ||
if len(bad_keys) > 0: | ||
raise AssertionError( | ||
"Test name{} not recognised: '{}'".format( | ||
"s" if len(bad_keys) > 1 else "", | ||
"', '".join(bad_keys), | ||
) | ||
mod_object.main_nf = mod | ||
mod_object.module_name = os.path.basename(mod) | ||
self.lint_module(mod_object, local=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only looking for bad keys right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah nevermind, a bit downstream ...
Co-authored-by: Kevin Menden <kevin.menden@live.com>
…ls into refactor-modules-lint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me and works locally when testing! 👍
Any further refactoring can still be handled after the v2.0 release then.
Another try at refactoring
nf-core modules lint
and adding module tests tonf-core lint
:nf-core lint
and made the general lint table and the module lint table work together.lint_utils.py
for code used by bothmodules lint
andlint
commands.On the way to resolving #1158. If these changes make sense, we should also update the markdown and json generation by
nf-core lint
to also include the modules tests.PR checklist
CHANGELOG.md
is updateddocs
is updated