question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

match-dir does not include files in subdirectories

See original GitHub issue

Let’s say I use an option --match-dir='^src' and have a folder src and I want to match everything inside this folder including files in subfolders, currently it skips all files inside subfolders

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:10
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
jamesbrazacommented, May 8, 2020

The only thing I could get to work was excluding directories by following the example here. I also could not figure out how to use a positive filter.

[pydocstyle]
match = (?!test_).*\.py
match_dir = ^(?!(venv|ci_tests|some_sub_dir)).*
0reactions
jonathanstaniforthcommented, Dec 28, 2020

Has there been any developments with matching directories using --match-dir? I would like to exclude all directories except for the directories mentioned in --match-dir.

Currently, I am trying to pass --match-dir as an argument to pydocstyle when using it as a pre-commit hook, however, it seems to not exclude directories and instead includes all directories.

An example of my .pre-commit-config.yaml file:

repos:
  ...
  - repo: https://github.com/pycqa/pydocstyle
    rev: 5.1.1
    hooks:
      - id: pydocstyle
        args:
          - --match-dir='^(src).*'

Solution

Pre-commit can restrict the files that are passed to pydocstyle using the files key, for example:

repos:
- repo: https://github.com/pycqa/pydocstyle
  rev: 5.1.1
  hooks:
  - id: pydocstyle
    files: ^src/

More information can be found here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to filter directories using the match-dir flag for pydocstyle?
Both methods appear to have no impact on the directories that are checked when pre-commit is run and pydocstyle checks all files in...
Read more >
How can I use a wildcard to match just files, not directories?
The question to exclude directories is a bit less simple; I propose to use the find -type f command. (I'll provide details on...
Read more >
Dir Function - Microsoft Support
String expression that specifies a file name — may include directory or folder, and drive. A zero-length string ("") is returned if pathname...
Read more >
node-dir - npm
A lightweight Node.js module with methods for some common directory and file operations, including asynchronous, non-blocking methods for recursively ...
Read more >
Open excel files in Folder and Copy | MrExcel Message Board
MyFile = Dir() changes the filepath to next filepathname? what does the Dir() part do because i have set no arguments so how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found