Skip to content

Pylint 2.14 breaks tox.ini integration with the unrecognized-option error #6800

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

Closed
aneuway2 opened this issue Jun 2, 2022 · 7 comments · Fixed by #6801
Closed

Pylint 2.14 breaks tox.ini integration with the unrecognized-option error #6800

aneuway2 opened this issue Jun 2, 2022 · 7 comments · Fixed by #6801
Labels
Configuration Related to configuration Regression
Milestone

Comments

@aneuway2
Copy link

aneuway2 commented Jun 2, 2022

Bug description

When running against Pylint version 2.14, Pylint complains with the unrecognized-option error when it attempts to read the tox.ini file, however these options are related to tox and not pylint.

The issue also does not occur if I set the deps of the tox.ini to pylint < 2.14.

I've reviewed the release notes and I don't believe there was any mention of changes to how a tox.ini file would need to be formated as the rc file,

Configuration

; tox.ini configuration file


[tox]
skipsdist = True
envlist = py3, pylint
indexserver =
    default=https://example.com

[testenv]
setenv = PYTHONWARNINGS=ignore

[testenv:pylint]
deps =
    pylint
    lazy-object-proxy >= 1.4.1
whitelist_externals = sh
commands =
    sh -c ' \
        find . -iname "*.py" | grep -v ".tox" | xargs -n 1 -P 3 pylint \
        --score=n \
        --output-format=colorized \
        --ignore=tests \
        --rcfile={toxinidir}/tox.ini \
    '

[pylint]
never-returning-functions=sys.exit
max-line-length=100
max-module-lines=5000
max-nested-blocks=10
min-public-methods=1
max-public-methods=20
max-statements=200
max-branches=50
max-locals=75
max-args=10
notes=
    FIXME,
    XXX,
    TODO
disable=
    import-error,
    unused-argument,
    broad-except,
    import-outside-toplevel,
    raise-missing-from,
    super-with-arguments,
    use-maxsplit-arg,
    consider-using-f-string

Command used

tox

Pylint output

************* Module /Users/gbowman/project/tox.ini
************* Module /Users/gbowman/project/tox.ini
tox.ini:1:0: E0015: Unrecognized option found: skipsdist, envlist, indexserver, setenv, deps, whitelist_externals, commands (unrecognized-option)
************* Module /Users/gbowman/project/tox.ini
tox.ini:1:0: E0015: Unrecognized option found: skipsdist, envlist, indexserver, setenv, deps, whitelist_externals, commands (unrecognized-option)
tox.ini:1:0: E0015: Unrecognized option found: skipsdist, envlist, indexserver, setenv, deps, whitelist_externals, commands (unrecognized-option)
************* Module /Users/gbowman/project/tox.ini
tox.ini:1:0: E0015: Unrecognized option found: skipsdist, envlist, indexserver, setenv, deps, whitelist_externals, commands (unrecognized-option)
...
continues

Expected behavior

pylint tests run within tox

Pylint version

pylint 2.14.0
astroid 2.11.5
Python 3.9.10 (main, Jan 15 2022, 11:48:00) 
[Clang 13.0.0 (clang-1300.0.29.3)]

OS / Environment

MacOS, iTerm2, Python 3.9

These tests also failed in our CI/CD environment using the python:3.8 docker image

Additional dependencies

pip freeze | grep tox

tox==3.25.0
@aneuway2 aneuway2 added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Jun 2, 2022
@DanielNoord
Copy link
Collaborator

This is an issue with the assumption that any ini file is a pylintrc file. I did not consider the use of tox.ini.

Perhaps we should special case tox.ini. Or special case .ini files in general.

@aneuway2 I don't use tox very often. Is tox.ini the standard name of this file? Or are there any other common names?

@aneuway2
Copy link
Author

aneuway2 commented Jun 2, 2022

Hey @DanielNoord! tox.ini is one of them. Specifically, tox looks for these filenames:

  • pyproject.toml
  • tox.ini
  • setup.cfg

source: https://tox.wiki/en/latest/config.html

@DanielNoord DanielNoord added Configuration Related to configuration Regression and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Jun 2, 2022
@DanielNoord
Copy link
Collaborator

I'm wondering how this interacts with #4371 and what we did for tox.ini in 2.13. It seems like we're still loading unrelated options.

@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.14.1 milestone Jun 2, 2022
@DDaxler
Copy link

DDaxler commented Jun 2, 2022

Hi, it seems pylint is unable to read my setup.cfg altogether.

`
$ pylint --version && pylint --rcfile=setup.cfg no_doc.py
pylint 2.14.0
astroid 2.11.5
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]
************* Module no_doc
no_doc.py:1:0: C0114: Missing module docstring (missing-module-docstring)
no_doc.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)


Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

$ pylint --version && pylint --rcfile=setup.cfg no_doc.py
pylint 2.13.0
astroid 2.11.5
Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:14:21) [MSC v.1929 64 bit (AMD64)]


Your code has been rated at 10.00/10

$ cat setup.cfg
[tool:pylint]
disable=missing-docstring

`

@DanielNoord
Copy link
Collaborator

DanielNoord commented Jun 2, 2022

Hi, it seems pylint is unable to read my setup.cfg altogether.

This is another issue. Could you test if [pylint] works?

See https://docs.python.org/3/distutils/configfile.html. I based our support of setup.cfg on this. Which seems to indicate that [pylint] should be used instead of [tool:pylint].

garrison referenced this issue in qiskit-community/quantum-prototype-template Jun 2, 2022
Otherwise, the build warns on Sphinx 5.0.0, and warnings are treated
as errors, so the docs build fails.
@DDaxler
Copy link

DDaxler commented Jun 3, 2022

Ohhh, yes it worked. Thank you !!
[pylint]

Shall I report this as a separate issue now that its not really that important?
Is this change intentional?

@DanielNoord
Copy link
Collaborator

Ohhh, yes it worked. Thank you !!

[pylint]

Shall I report this as a separate issue now that its not really that important?

Is this change intentional?

I think we'll keep this as being intentional for now. Unless we would get a lot of reports about this.

Tools struggle a lot with parsing configuration files because of the lack of clear documentation for some of the older formats. Trying to enforce a bit of consistency makes both our own code a little simpler and helps the broader ecosystem by creating some "standards".

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

Successfully merging a pull request may close this issue.

4 participants