-e/--exclude doesn't work with pre-commit

See original GitHub issue

Environment

  • interrogate version: 1.3.1
  • Operating System(s): Windows
  • Python version(s): 3.7.7

Description of the bug

Using the -e/--exclude argument works perfectly fine when using interrogate directly on the command line. However, when I pass it in my .pre-commit-config.yaml file like so:

- repo: https://github.com/econchick/interrogate
      rev: 1.3.1 # or master if you're bold
      hooks:
          - id: interrogate
            args: [--exclude=tests, --fail-under=100]

The argument doesn’t seem to take effect. So far, I have resulted to using --ignore-regex which does work and achieves the same goal. Still, strange that --exclude doesn’t seem to work. Maybe I am doing something wrong?

What you expected to happen

I expected --exclude to work using pre-commit.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
s-weigandcommented, Nov 29, 2020

My solution is adding pass_filenames to the hook

  - repo: https://github.com/econchick/interrogate
    rev: 1.3.2
    hooks:
      - id: interrogate
        args: [-vv, --config=pyproject.toml]
        pass_filenames: false

That way interrogate runs as if you were running it from CLI.

Maybe this should be part of the defaults for the hook?

2reactions
econchickcommented, Oct 13, 2020

Seems like a reasonable expectation 😃 Thanks for the issue! I’ll try to set some time aside over the next week to look deeper into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre-commit-hook ignores exclude patterns · Issue #395 - GitHub
My team wants to try black as a pre-commit hook on a provisional basis, so we run it only on files in one...
Read more >
Exclude some files on running black using pre-commit
pre -commit finds all the python files, then applies pre-commit 's exclusion, and then passes that list of files to the underlying tools...
Read more >
pre-commit
Run pre-commit install to install pre-commit into your git hooks. pre-commit will now run on every commit. Every time you clone a project...
Read more >
Exclude vendor folder from Before Commit hooks : GO-11245
The "Before Commit" actions selected in Settings -> Version Control -> Commit run only on own code and exclude packages in the vendor...
Read more >
Pre-commit - Made With ML
It is highly not recommended to skip running any of the pre-commit hooks because they are there for a reason. But for some...
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