Skip to content
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

[FIX] rst-syntax-error: Skip unknown directives and roles #66

Merged
merged 2 commits into from
Sep 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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`