Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mlin committed Jun 28, 2019
1 parent 8688f83 commit f38ef1f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
21 changes: 20 additions & 1 deletion WDL/Lint.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
# pylint: disable=protected-access
"""
Linting: annotate WDL AST with hygiene warning
Annotate WDL document AST with hygiene warnings (underlies ``miniwdl check``)
Given a ``doc: WDL.Document``, the lint warnings can be retrieved like so::
lint = WDL.Lint.collect(WDL.Lint.lint(doc, descend_imports=False))
for (pos, lint_class, message) in lint:
assert isinstance(pos, WDL.SourcePosition)
assert isinstance(lint_class, str) and isinstance(message, str)
print(json.dumps({
"filename" : pos.filename,
"line" : pos.line,
"end_line" : pos.end_line,
"column" : pos.column,
"end_column" : pos.end_column,
"lint" : lint_class,
"message" : message,
}))
The ``descend_imports`` flag controls whether lint warnings are generated for imported documents
recursively (true, default), or otherwise only the given document (false).
"""
import subprocess
import tempfile
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Error
:members:
:show-inheritance:

Lint
----
.. automodule:: WDL.Lint

Indices and tables
==================
Expand Down
1 change: 1 addition & 0 deletions tests/test_3corpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class Lint(unittest.TestCase):
# test programmatic access to linter results
# this code should be kept in sync with the example shown in the WDL/Lint.py docstring.
def test_api(self):
doc = WDL.load(
"test_corpi/HumanCellAtlas/skylab/pipelines/smartseq2_single_sample/SmartSeq2SingleSample.wdl",
Expand Down

0 comments on commit f38ef1f

Please sign in to comment.