Skip to content

Commit

Permalink
Merge pull request #66
Browse files Browse the repository at this point in the history
[FIX] rst-syntax-error: Skip unknown directives and roles
  • Loading branch information
dreispt authored Sep 16, 2016
2 parents e42dc41 + 91a0d89 commit e92f000
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ Example to test just odoo-lint case:

If you have external files you can add them in ``examples`` folder to skip.

For rst-syntax-error skip unknown directives


.. |Build Status| image:: https://travis-ci.org/OCA/pylint-odoo.svg?branch=master
:target: https://travis-ci.org/OCA/pylint-odoo
Expand Down
14 changes: 13 additions & 1 deletion pylint_odoo/checkers/modules_odoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import ast
import os
import re

import astroid
from pylint.checkers import utils
Expand Down Expand Up @@ -249,9 +250,20 @@ def _check_rst_syntax_error(self):
errors = self.check_rst_syntax(
os.path.join(self.module_path, rst_file))
for error in errors:
msg = error.full_message
res = re.search(
r'No directive entry for "([\w|\-]+)"|'
r'Unknown directive type "([\w|\-]+)"|'
r'No role entry for "([\w|\-]+)"|'
r'Unknown interpreted text role "([\w|\-]+)"', msg)
# TODO: Add support for sphinx directives after fix
# https://github.com/twolfson/restructuredtext-lint/issues/29
if res:
# Skip directive errors
continue
self.msg_args.append((
"%s:%d" % (rst_file, error.line),
error.full_message.strip('\n').replace('\n', '|')))
msg.strip('\n').replace('\n', '|')))
if self.msg_args:
return False
return True
Expand Down
32 changes: 32 additions & 0 deletions pylint_odoo/test_repo/broken_module2/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,35 @@ Test module 2
=============

This module was written to check the test lint


*******
Project
*******

.. toctree::
:maxdepth: 1

project/contribute
project/contributors
project/license
project/changes
project/roadmap

*****************
Developer's guide
*****************

.. toctree::
:maxdepth: 2

guides/concepts.rst
guides/code_overview.rst

******************
Indices and tables
******************

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

0 comments on commit e92f000

Please sign in to comment.