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

Configurable extra RST directives and roles #16

Merged
merged 4 commits into from
Aug 7, 2019
Merged

Configurable extra RST directives and roles #16

merged 4 commits into from
Aug 7, 2019

Conversation

peterjc
Copy link
Owner

@peterjc peterjc commented Aug 7, 2019

This should close #7.

Example tested on a large code base - the following worked on the numpy master branch (they use Sphinx with their own numpydocs extension):

$ flake8 --select RST303,RST304 --rst-directives autosummary,data,currentmodule,deprecated,glossary,moduleauthor,plot,testcode,versionadded,versionchanged --rst-roles attr,class,func,meth,mod,obj,ref,term,c:member,py:func,py:mod numpy/

i.e. If they were using flake8, they could put this in their config file:

[flake8]
rst-directives =
    # These are sorted alphabetically - but that does not matter
    autosummary,data,currentmodule,deprecated,
    glossary,moduleauthor,plot,testcode,
    versionadded,versionchanged,
rst-roles =
    attr,class,func,meth,mod,obj,ref,term,
    # C programming language:
    c:member,
    # Python programming language:
    py:func,py:mod,

Copy link

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love this! Thanks 👍

@peterjc
Copy link
Owner Author

peterjc commented Aug 7, 2019

Thanks @sobolevn.

I've got an afternoon meeting now, but barring any changes being suggested in the interim, I expect to do the merge and release later today.

@bskinn
Copy link
Contributor

bskinn commented Aug 7, 2019

This looks like a really clean solution. Nice work!! Once the new release is out, I will definitely put it to use... strip out my blanket RST303/RST304 ignores and add the granularity.

Thanks!

@peterjc peterjc merged commit 6d833df into master Aug 7, 2019
@peterjc peterjc deleted the roles branch August 7, 2019 14:19
@peterjc
Copy link
Owner Author

peterjc commented Aug 7, 2019

Please give v0.0.11 a shot now, up on PyPI - conda-forge to follow.

@bskinn
Copy link
Contributor

bskinn commented Aug 7, 2019

CI passed just fine, with the new version of and config for flake8-rst-docstrings in place.

👍 🎊 🎉

@peterjc
Copy link
Owner Author

peterjc commented Aug 7, 2019

Excellent. Nice to see this being immediately useful, thanks for sharing that real world example.

@jlumbroso
Copy link

jlumbroso commented Jan 2, 2021

This feature is 👌🏻👌🏻👌🏻. 😁

@peterjc Thanks for implementation! @bskinn @sobolevn Thanks for testing!

ansible-zuul bot pushed a commit to ansible/ansible-navigator that referenced this pull request Jan 27, 2022
Add `mod` as permitted RST role

This adds mod to the user list of sphinx roles in the flake8 file.  It was being reported by flake8-rst-docstring whcih is being vetted as it is included in the wemake style guide.
This was the error begin reported:
tests/unit/test_utils.py:1:1: RST304 Unknown interpreted text role "mod".
"""Test the functions exposed in the :mod:`~ansible_navigator.utils` subpackage."""
^

Some good info about this is here: peterjc/flake8-rst-docstrings#16

Reviewed-by: Rick Elrod <[email protected]>
Reviewed-by: None <None>
ssbarnea pushed a commit to ssbarnea/ansible-navigator that referenced this pull request Feb 12, 2022
Add `mod` as permitted RST role

This adds mod to the user list of sphinx roles in the flake8 file.  It was being reported by flake8-rst-docstring whcih is being vetted as it is included in the wemake style guide.
This was the error begin reported:
tests/unit/test_utils.py:1:1: RST304 Unknown interpreted text role "mod".
"""Test the functions exposed in the :mod:`~ansible_navigator.utils` subpackage."""
^

Some good info about this is here: peterjc/flake8-rst-docstrings#16

Reviewed-by: Rick Elrod <[email protected]>
Reviewed-by: None <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gives errors on well known text roles
4 participants