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

New directory walking should ignore hidden folders #49

Open
peterjc opened this issue Nov 14, 2018 · 2 comments
Open

New directory walking should ignore hidden folders #49

peterjc opened this issue Nov 14, 2018 · 2 comments

Comments

@peterjc
Copy link
Contributor

peterjc commented Nov 14, 2018

I was looking forward to the new directory parsing functionality added in v1.2 to close #38, however it does not work well if you have hidden folders like .tox present. I would expect .venv would be another common problem case.

$ rst-lint --version
1.2.1
$ rst-lint --level warning .
SEVERE ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/invalid_line_mismatch.rst:1 Title overline & underline mismatch.
WARNING ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/invalid.rst:2 Title underline too short.
WARNING ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/second_short_heading.rst:6 Title underline too short.
WARNING ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/second_short_heading.rst:6 Title underline too short.
ERROR ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/invalid_link.rst:None Anonymous hyperlink mismatch: 1 references but 0 targets.
See "backrefs" attribute for IDs.
ERROR ./.tox/style/lib/python2.7/site-packages/restructuredtext_lint/test/test_files/invalid_target.rst:1 Unknown target name: "fork me on github <https://github.com/evvers/git-pre-commit-hook".

I would suggest that the recursion ignore hidden folders by default (leading .), and possibly also any hidden RST files too?

@twolfson
Copy link
Owner

twolfson commented Nov 14, 2018

flake8 seems to recurse into . folders. I think the expected usage is to use a glob for files and specify folders to recurse (e.g. flake8 *.rst restructuredtext_lint/) =/

$ flake8 .
./.test/foo.py:1:10: E999 SyntaxError: invalid syntax

There is an option for --exclude which does ignore .tox. I'm happy to accept another PR for this behavior:

  --exclude=patterns    Comma-separated list of files or directories to
                        exclude. (Default:
                        .svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg)

@peterjc
Copy link
Contributor Author

peterjc commented Nov 14, 2018

I was starting to explore how flake8 did this, the --exclude=patterns approach seems worth using here too 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants