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

__init__.py files included despite pyproject.toml negating them #145

Closed
rjalexa opened this issue Mar 7, 2023 · 3 comments
Closed

__init__.py files included despite pyproject.toml negating them #145

rjalexa opened this issue Mar 7, 2023 · 3 comments
Assignees
Labels
bug Something isn't working needs triage Issue needs triaging

Comments

@rjalexa
Copy link

rjalexa commented Mar 7, 2023

Environment

  • interrogate version(s) (interrogate --version: version 1.5.0
  • Operating System(s): Mac OS Ventura 13.2.1
  • Python version(s): 3.10.9

Description of the bug

pyproject.toml option ignore-init-module = true gets honoured when interrogate is launched from command line, but is NOT honoured when invoked from pre-commit

What you expected to happen

I would expect my init.py to be ignored when interrogate is invoked either way (command line or pre-commit)

How to reproduce (as minimally and precisely as possible)

.pre-commit-config.yaml contains the following:

repos:
  - repo: https://github.com/econchick/interrogate
    rev: 1.5.0
    hooks:
      - id: interrogate

pyproject.toml

[tool.interrogate]
ignore-init-method = true
ignore-init-module = true
ignore-magic = false
ignore-semiprivate = false
ignore-private = false
ignore-property-decorators = false
ignore-module = false
ignore-nested-functions = false
ignore-nested-classes = true
ignore-setters = false
fail-under = 95
exclude = ["docs", "rja_dev"]
ignore-regex = ["^get$", "^mock_.*", ".*BaseClass.*"]
# possible values: 0 (minimal output), 1 (-v), 2 (-vv)
verbose = 1
quiet = false
whitelist-regex = []
color = true
omit-covered-files = false
generate-badge = "."
badge-format = "svg"

Run from pre-commit:

(memaback-py3.10) (base) bob@Roberts-Mac-mini memaback % pre-commit run --all-files
interrogate..............................................................Failed
- hook id: interrogate
- exit code: 1

= Coverage for /Users/bob/Documents/work/code/memaback/ =
- Summary -
| Name                                         | Total | Miss | Cover | Cover% |
|----------------------------------------------|-------|------|-------|--------|
| src/memaback/__init__.py                     |     1 |    1 |     0 |     0% |
| src/memaback/mema_fetch_article_url.py       |     8 |    0 |     8 |   100% |
| src/memaback/mema_nlp_ensemble_experiment.py |    16 |    0 |    16 |   100% |
| tests/__init__.py                            |     1 |    1 |     0 |     0% |
| tests/test_mongoconn.py                      |     2 |    0 |     2 |   100% |
|----------------------------------------------|-------|------|-------|--------|
| TOTAL                                        |    28 |    2 |    26 |  92.9% |
- RESULT: FAILED (minimum: 95.0%, actual: 92.9%) -
Generated badge to /Users/bob/Documents/work/code/memaback/interrogate_badge.svg

Anthing else we need to know?

@rjalexa rjalexa added bug Something isn't working needs triage Issue needs triaging labels Mar 7, 2023
@pawel-czyz
Copy link

I'm using Python 3.9.7 and interrogate 1.5.0 and I have observed similar behavior with respect to the exclude argument:

$ interrogate quiet   # Works properly
$ pre-commit run
interrogate..............................................................Failed
- hook id: interrogate
- exit code: 1

and the error is due to one of the files which are listed in exclude.

@jimrybarski
Copy link
Contributor

Add pass_filenames: false to your hook. See: #60 (comment)

@pawel-czyz
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Issue needs triaging
Projects
None yet
Development

No branches or pull requests

4 participants