interrogate icon indicating copy to clipboard operation
interrogate copied to clipboard

-I doesn't work with pre-commit

Open lorenzomammana opened this issue 3 years ago • 1 comments

Environment

  • interrogate, version 1.5.0
  • OS: Windows 10
  • Python version: 3.8.10

Description of the bug

I'm trying to use interrogate through pre-commit with this hook

  - repo: https://github.com/econchick/interrogate
    rev: 1.5.0
    hooks:
      - id: interrogate
        language: python
        types: [python]
        args:
          [
            "-vv",
            "-i",
            "-I",
            "-M",
            "--fail-under=60",
         ]

If I run pre-commit run --all-files I obtain

| TOTAL                                         |   517 |  378 |   139 |  26.9% |
--------------- RESULT: FAILED (minimum: 60.0%, actual: 26.9%) ----------------

If instead I run interrogate -vv -i -I -M --fail-under=60 . I obtain

| TOTAL                                                      |             491 |            364 |             127 |            25.9% | 
------------------------------------------- RESULT: FAILED (minimum: 60.0%, actual: 25.9%) ------------------------------------------- 

That is because in the first case __init__.py are not ignored, while in the second case they are correctly ignored as by -I documentation.

I've done the test also on -M and -i but these two parameter works properly resulting in the same output on both executions.

What you expected to happen

Output of both run should be exactly the same

How to reproduce (as minimally and precisely as possible)

Run interrogate with -I parameter using pre-commit and using cli on an __init__.py file that lacks documentation, the one from cli should pass, the one from interrogate should wrongly fail.

Anthing else we need to know?

I guess it's pretty much the same problem of #60 but here there's no workaround!

lorenzomammana avatar Jan 11 '22 22:01 lorenzomammana

Add pass_filenames: false to your hook. See: https://github.com/econchick/interrogate/issues/60#issuecomment-735436566

jimrybarski avatar Sep 09 '23 01:09 jimrybarski