-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add the files
option
#7496
base: main
Are you sure you want to change the base?
Add the files
option
#7496
Conversation
Pull Request Test Coverage Report for Build 3787353582
💛 - Coveralls |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like this, we're adding complexity and yet another option on top of something that should be simple with no option. We have to think of ease of use for new users too
Hm, I don't think this adds too much complexity? Other tools work similarly. For example, For normal users nothing changes as they can keep using the CLI like they used to. We're just exposing the internal aggregation of all left over arguments into a |
We saw when migrating the configuration to pyproject.toml that we have a lot more verbosity than other tool. Being configurable is a strength. But sometime there's a clear choice that we need to make to make the tool better especially when we choose what the default should be. The result of the vote on #5701 is currently more than 5 against one in favor of having a default value that permit to do |
I understand that the vote is in favour of the other option, but in this case I think as maintainers we should make a different choice than our users:
The option (imo) is not new, it was only unexposed and for the cost of having to set it once users can get all the benefits of the original proposal but sooner and without having to add additional ignores. |
There's breaking change and "breaking change". Changing the default value for pylint only remove the help message when calling
Some other use the current directory as a sensible default, this is an argument we had in #5701 and the issue was here to settle it. Beside "some tool does it" is not an argument in itself, what's the underlying reason to do it ? I think if a sensible default is possible then the sensible default should be used.
There's a million way to do that if you're the kind of person that have a pylintrc and that actually read the doc to find this option. (pre-commit exclude, not using the recursive option, find piped in pylint, git ls specifying each files, using ignore/ignore pattern... etc). We could even add the files option to do it as long as it's not required so that
#6471 was fixed, it's really easy to ignore venvs now. |
It will break any documentation/guide that says you can use
Yeah, but that issue has given almost no arguments for doing so in response to my arguments against it. The only one who actually engaged with me showed how easy it would be to use this proposal. Another comment showed how the user is linting Nobody has responded to my argument that
And I believe it is not sensible to have
Which tools do? I checked in our own
Yeah, but my argument is that doing 1) |
I'm not against having a
Using
You can't expect everyone to argue about it, they took the time to vote though. I did not want to argue about it for hours which is why I opened #5701 in the first place. I don't think what we should go against the result when what people want is that clear. (even if I wasn't strongly in favor of defaulting to the current directory myself). If you want I can answer in the original issue for more visibility but:
I don't think we should guess. If the user do not specify anything it means they want to lint everything recursively in the current directory. This is the overwhelming result of the vote on the issue when we ask about it. This is apparent in the maybe 20+ duplicate issues that complain that pylint "misses" files because there's no
|
I would expect at least somebody to respond.
I understand it gives some ease of use to users, but I think we can also agree that a passerby user doesn't consider all the edge cases that could be introduced with behaviour that works fine for them. That's where we as maintainers have a role to (sometimes) deviate from popular demand.
I don't understand your point here. Are you suggesting
I made this point in a previous comment/paragraph as well: the fact that some users express their desire for something isn't a 100% justification to do something. If it was, we would integrate
As far as I can see running |
Yes, because most of the time the current directory is not a package and we would have an error otherwise.
You probably have a venv with a lot of code in it, switch to a directory with less code.
black is not even comparable, I wouldn't even think of adding pylint or flake8 without the code being first auto-formatted with isort/black. mypy being used more means it does something better than pylint and flake8. But it does not mean they do everything better in every possible aspect. What makes mypy more successful is not "having a files options", but if I had to guess proper control flow, being maintained by Guido himself, having 100 times less false positives as a result, fixing a fundamental need in a dynamic language, and being less opinionated as its warning are about error only not about warning convention, and refactor.
I'm a maintainer and I don't see any worrying edge cases. I also don't like having to type If you have a full packaging environment with Users expect to have this value as default, we already disagreed about this previously so we launched a vote and now we have a result. It's also not that big of a deal, can we move on and focus on something impactful please ? |
Do we still want to add this option irrespective of #5701? For power users it might make sense? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure ! The change itself look almost "too simple" 😄
I think that was actually the only change necessary. Rest seems like it can be merged as is? |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep that in mind but I think there should be a lot more tests (probably functional config tests too). Current code looks good but I have to think about what could go wrong and use cases which would take time that I don't have right now.
77f1dbc
to
75fdce0
Compare
🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉 This comment was generated for commit 75fdce0 |
I feel like this is worth it either way? I don't really see how this is connected although I could change this config to use a glob instead of csv. Do you want me to do that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think glob is nicer than csv. But mainly I think we have a ton of option to select/unselect and I basically agree with #8312 (comment), we should refactor / simplify this part of the documentation and make sure options are consistent together.
Hmm, I just remembered that this can't use Perhaps it is indeed better to fix this in |
Yeah, a lot of problem are due to the unclear way to select file for pylint. Things like #8319 ? |
@Pierre-Sassoulas This recently came up again: we don't have a Should this go in |
I think having a default to the current directory will fix the issue of the wall of help text when giving no arguments at all. Regarding the files options itself we could add it, but imo we need to look at how it's done in other tools (Ruff in particular), and do something consistent if we break or add options to discover files. |
I want to unblock this but I don't know what's blocking it anymore ? |
I'm not sure what you meant with the last comment. Is this approach correct or are you looking to do something different? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we definitely need to have an explicit destination for the currently nebulous/positional file args (right now it's hard to even know what is parsed and where to add a default value). I think linter.config.files
always containing the files to process is the main benefit here. And being able to define the files in the conf is an added feature on top of it.
Okay, but the tests passed previously. Is there anything missing from this other than a rebase? |
I didn't see any blocker thus my searching for what's blocking 😄 Let's rebase first. Reading the previous review (#7496 (review)), I don't think we had a reflection concerning csv vs globbing vs regex and what we have in pylint currently to make it consistent internally and also taking inspiration from how other tools like mypy/ruff are doing it afaik. What's the rational for the current design ? To be fair I think those options (regex/glob/csv) have grown in pylint each time someone asked to be able to do something -- organically. I wouldn't be able to tell you what is pylint doctrine for discovering files or filtering/affecting files with options. Should we offer all three methods in every options ? What type of file discovery should |
towncrier create <IssueNumber>.<type>
which will beincluded in the changelog.
<type>
can be one of: new_check, removed_check, extension,false_positive, false_negative, bugfix, other, internal. If necessary you can write
details or offer examples on how the new change is supposed to work.
and preferred name in
script/.contributors_aliases.json
Type of Changes
Description
EDIT: Doesn't close ... #5701, see discussion down below.
The change itself turned out to be very minimal. We probably need some testing of this though as I might have disregarded edge-cases. A beta for
2.16
would be good.