This validates ModuleMD YAML files according to the currently published Fedora Packaging Guidelines for Modules.
rebased onto 0b2a19955ac6614ca027a7389151f2b1691962b7
@nphilipp, I would drop modulemd, just lintmd, lint-md, or simply lint.
modulemd
lintmd
lint-md
lint
rebased onto deb982f65bca6bacd8cb3f5e8b4822f9a692ab62
@igulina done
5 new commits added
9 new commits added
fedmod doesn't work at all on 2.7 (we allow the use of f-strings, so it doesn't even work on 3.5), so you don't need these.
This can be shortened to fn.lint_guidelines_url = f"{self.guidelines_base_url}#{anchor}"
fn.lint_guidelines_url = f"{self.guidelines_base_url}#{anchor}"
For input validation, an if/raise ValueError pair is preferable to an assert statement.
if
raise ValueError
assert statements are removed for python -O, so these should all be handled via a helper function, rather than an assert statement.
assert
python -O
+1 from me - main issue I noticed is that assert shouldn't be used for actual program logic - similar to C, it may get compiled out depending on how you run Python.
I did some poking around to see if I could find a higher level baseline library to build the linting engine on, but nothing obvious stuck out at me. https://pypi.python.org/pypi/yamllint did come up as a potentially interesting option to run implicitly, though.
we allow the use of f-strings, so it doesn't even work on 3.5
We might reconsider that in order to support people who are stuck on older versions of py3k, uh, enterprise operating systems. :wink:
See above :smile:
I understood that this would be a programmer error rather than a user one, i.e. doing the input validation explicitly in the CLI before calling lint().
lint()
Good catch. Just a pity that this will add more parentheses... :wink:
rebased onto 146d97d293c2d1870846f6267b57243e1d6901da
The latest rebase adds the --min-level option and validates the user input before passing it into linter.lint(...).
--min-level
linter.lint(...)
12 new commits added
1 new commit added
3 new commits added
16 new commits added
21 new commits added
In relation to the minimum Python version: targeting 3.6 is based on the fact that Fedora 26+ is on 3.6, and that latest RHSCL release means 3.6 is also available in supported form for RHEL 7, and in community form for CentOS 7 at https://www.softwarecollections.org/en/scls/rhscl/rh-python36/
So if we're going to require an SCL (or equivalent) on EL 7, it may as well be the latest one :)
31 new commits added
32 new commits added
6 new commits added
2 new commits added
using filter: {} gives a traceback instead of stating that filter requires a list (even if empty)
having
modules: {}
after the component rpm list causes lint to print out "One or more 'components' block is empty"
One more corner case: filters: ~ gives a traceback.
Is buildrequires: ~ or requires: ~ valid to state that there are no requirements ? lint doesn't accept that.
LGTM now
Pull-Request has been merged by karsten
Thanks for the review!
This validates ModuleMD YAML files according to the currently published Fedora Packaging Guidelines for Modules.