-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Pylint no longer support separating options from positional arguments with -- #7003
Comments
Thank you for opening the issue. I added the discussion label because I don't know if we want to deviate from what argparse is doing and if it's worth it. In your example it's possible to use |
Argpase supports this syntax. From https://docs.python.org/3/library/argparse.html#arguments-containing:
So this should work out of the box, and I'm wondering why it doesn't.
yes, the real use case is e.g. a script that wraps Pylint and receives arbitrary filenames, which might start with a dash.
It's quite established, see e.g. the GNU Coding Standards (https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html) or POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02, guideline 10). |
I don't think this is fixed. $ pylint --version
pylint 2.15.2
astroid 2.12.9
Python 3.10.6 (main, Aug 30 2022, 04:58:14) [Clang 13.1.6 (clang-1316.0.21.2.5)]
$ pylint -- build.py
************* Module --
--:1: [F0001(fatal), ] No module named -- That is, Pylint now thinks that it should lint a file named |
Hm, that's weird. My test might not be good enough. Putting this on my TODO list. |
@Pierre-Sassoulas Based on previous knowledge I think this should be a quick fix. If possible I'd like to get this into the patch release as well. I'll tell you after fixing the open PR if I can get a quick PR in for this as well! |
I[m going to look into another solution which will take some more time. Moving this from the milestone. |
Thanks but this still doesn't work. The purpose of the
|
Can you give an example of how you would actually use this? The issue is that |
The concrete case is https://github.com/phst/rules_elisp/blob/b79e86bc6adfdbba2576129f0a48e120afccd1c3/check_python.py#L83, but the general thinking is that wrapper scripts in general can't and shouldn't know whether filenames start with a dash or not. For example, a wrapper script like
shouldn't have to parse the argument list passed by the user or fail with weird errors (or worse, silently pass undesired options) if one of the files happens to start with a dash. One reason for the
Maybe I'm missing something, but doesn't
|
The issue is that we don't have the I'm not sure we can add the |
Bug description
With Pylint 2.12,
pylint -- file.py
works as expected, with Pylint 2.14 it raises an error like "pylint: error: Unrecognized option found:". I guess that's related to the argparse migration.Configuration
No response
Command used
Pylint output
Expected behavior
The
--
should separate options from positional arguments. In this case the invocation should have identical results topylint file.py
.Pylint version
OS / Environment
Debian GNU/Linux
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: