-
-
Notifications
You must be signed in to change notification settings - Fork 479
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
Fix W391 linter issues #35109
Fix W391 linter issues #35109
Conversation
I strongly disagree with these changes and the fact this is even a part of the linter. It completely disagrees with the specification (https://www.flake8rules.com/rules/W391.html), which says there should be exactly one blank line at the end of a file. After this change, there are 0 blanklines at the end. They either need to learn how to count or change their specification. I also find it more difficult to read without that blankline. |
I didn't introduce this change. It has been enabled in fba8e59. Currently, the linter on the develop branch fails because of this: https://github.com/sagemath/sage/actions/runs/4160169660/jobs/7196912078, which also make it fail for all PRs based on it. So can we please get this in? |
I'm sorry, but that isn't really an argument. I could just as well introduce a PR that removes that as a requirement with one person agreeing to it as I don't recall us setting that as a standard. If I missed it, then I will just grumble quietly. However, I have created a topic on sage-devel asking about what "one blankline" means: https://groups.google.com/u/2/g/sage-devel/c/SsghcSi6mfw |
If there is a controversy, it should rather be debated on sage-devel, no ? In my opinion, it is the implementation that really says the expected meaning of these warnings. I agree that the description given by flake8rules is wrong. The one in |
This is the implementation: https://github.com/PyCQA/pycodestyle/blob/b22b672a1a53f1ef35c4f4689c674d66a24138ed/pycodestyle.py#L250-L253 |
Okay, I think I understand. They are counting the number of newline characters at the end, which are really "end-of-line" characters. For example,
So my misunderstanding comes from what they are specifying as a "blankline" should be newline character. I will just grumble quietly from here-on-out about git noting that there is no blankline and not being able to scroll that one extra line. Sorry for the trouble. |
Documentation preview for this PR is ready! 🎉 |
No worries! Some IDE's have the ability to add a virtual new line at the end of the file. This might be something for you ;-). Will merge this PR now to fix the CI pipeline. |
git does not complain about missing blank lines. It would complain about a file ending without a newline character at the end. |
I remember it used to do so. I checked this now and it doesn't do what it used to do previously, unless it was my editor not putting newline characters at the end (which I highly doubt). |
📚 Description
Fixes a couple of W391 linter issues that were introduced by merging a couple of trac tickets.
📝 Checklist
⌛ Dependencies