Commit 2699debf authored by Teake Nutma's avatar Teake Nutma
Browse files

Merge branch 'tn/docstring-linter' into 'develop'

docstring linter

See merge request !28
parents 742e0239 9cbfeb3e
Pipeline #1133 passed with stage
in 2 minutes and 42 seconds
......@@ -9,10 +9,27 @@ cache:
- .pip-cache
- .tox
lint:
script:
- tox -e lint
stages:
- test
test:
unit_tests:
stage: test
script:
- tox -e test
lint_docs:
stage: test
allow_failure: true
script:
- tox -e lint_docs
lint_style:
stage: test
allow_failure: true
script:
- tox -e lint_style
lint_syntax:
stage: test
script:
- tox -e lint_syntax
......@@ -13,9 +13,6 @@ from .datamodel import DataModelFile
class FileValidator(abc.ABC, IssueReportAware):
"""Interface that all datamodel file validators must implement / inherit."""
def __init__(self):
super().__init__()
@abc.abstractmethod
def validate(self, file: DataModelFile) -> bool:
"""Validate one single datamodel file."""
......@@ -69,8 +66,7 @@ class FilenameValidator(FileValidator):
if not self.valid_regex.match(filename):
self.issue_report.add_issue("Filename does not satisfy relaxed requirements.", file)
return False
else:
return True
return True
class _XmlSchemaValidator(FileValidator):
......
......@@ -6,13 +6,31 @@ commands=
python -m pytest --cov=datamodelvalidator/ tests/
[testenv:lint]
[testenv:lint_style]
deps=
pep8
pylint
commands=
# Pylint 1.6.4 does not fully support PEP 484 type hints, which is why we also use pep8.
# When pylint 2.0 is released we could rely solely on pylint (without the --disable=R,C option) and remove pep8.
pep8 --max-line-length=120 datamodelvalidator/ tests/
# no-value-for-parameter is disabled because pylint doesn't take decorators into account (pylint issue #207
pylint --max-line-length=120 --reports=no --disable=R,C,no-value-for-parameter,protected-access --extension-pkg-whitelist=lxml datamodelvalidator
[testenv:lint_syntax]
deps=
pylint
commands=
# no-value-for-parameter is disabled because pylint doesn't take decorators into account (see pylint issue #207)
pylint datamodelvalidator \
--reports=no --score=no --max-line-length=120 --disable=C,R0903,no-value-for-parameter,protected-access \
--extension-pkg-whitelist=lxml
[testenv:lint_docs]
ignore_errors=True
deps=
pylint
pydocstyle
commands=
pylint datamodelvalidator \
--reports=no --score=no \
--load-plugins=pylint.extensions.docparams \
--accept-no-param-doc=no --accept-no-raise-doc=no --accept-no-return-doc=no --accept-no-yields-doc=no \
--disable=all --enable=C0111,parameter_documentation
pydocstyle datamodelvalidator --convention=numpy --add-ignore=D1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment