-
Notifications
You must be signed in to change notification settings - Fork 1.6k
new lint: path_ends_with_ext
#11483
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
new lint: path_ends_with_ext
#11483
Conversation
r? @Alexendoo (rustbot has picked a reviewer for you, use r? to override) |
This would have a fair few false positives with stuff like If we can source one shipping a big list of file extensions would probably be the ideal solution since it wouldn't take up all that much space, the problem being how easily it is to source such a list |
Maybe a configuration option for additional dotfiles to allow would also be useful. |
I suggest limiting it to 2-char and 3-char extensions. The longer the name, the more likely it is a dotfile. I don't have any 2-char dotfiles. The 3-letter dotfiles I could find: .git .svn .gem .npm .vim .env .rnd .ssh .vnc |
That sounds great, I implemented this in the last commit (that and the ability to add custom dotfiles that clippy shouldn't warn). |
How is this different from #6425 🧐 |
The description and code looks like it has a little bit of overlap and sounds similar, but that one seems to look for a different kind of suspicious pattern and I would say this one is different enough to be its own lint. This lint looks for We may want to change the suggestion to use |
…hearth Truncate files when opening in metadata-collector Fixes the issue seen here #11483 (comment) and in a couple other PRs The changelog file was opened without truncating it, so if the new version is shorter than the old one stray contents would remain at the end of the file The other two files first removed the file so didn't have this problem, but in all cases we now use `fs::write`/`File::create` which is write + create + truncate changelog: none
Thanks! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Closes #11479
Not sure if it needs more test cases. I couldn't come up with any other ones, but it is a pretty simple lint logic wise with not too many checks
changelog: new lint: [
path_ends_with_ext
]