This release includes the Beta version of the Ruff formatter — an extremely fast, Black-compatible Python formatter.
Try it today with ruff format.
Changes
Preview features
[pylint] Implement non-...
I have to admit… compared to some older ruff I had on disk it now reports like double of “errors”. 99% of them irrelevant to actual issues. It’s over reporting silly things so much it has become useless to use. It may or may not report something critical between all the noise, but it’s hard to see the tree because of the forest, so to speak.
I guess this is that new “black” stuff?
If I was to make my code compatible to what it wants I couldn’t use/read it anymore. :) Probably my programs would stop working too:
T201 `print` found
I guess I have to comment that out.
ERA001 Found commented-out code
Oups. I guess I just rm *.py to fix the madness. 😎
My projects are usually just standalone scripts, so no pyproject.toml.
I use a global “.pylintrc” in my home directory for pylint, which I occasionally copy over to project folders that get synced to public github repositories, but that’s it.
I think that one off standalone scripts are probably not the use case linters (especially ones like ruff that prioritize speed on large code bases) have in mind
I only experimented with it briefly (the old version and the new version I downloaded today). I don’t remember configuring anything, so I assume it runs like that by default:
Certainly this will become more useful toned down to sane limits, but it needs time/ research/ reading lots of documentation(?) to sort that out. A more sane default would be nice, IMHO.
If your project has a significant enough scope that a tool like ruff is warranted, you really should have proposer logging setup instead of print statement, and you should be relying on your version control instead of commenting out code.
Anyway time for you to get some humbleness and realize the fault lies with the person in the chair. You. Not even reading the first page of the documentation or following it learning best practices to pick or not pick. Then coming a making an obviously uninformed comment.
“Clean code” is always about preference. I like code I can read and understand. If I want extra comments or keep some commented code to make a thought process about a coding decision more clear then that’s not a bad thing, IMHO.
And if print() is such a bad thing, why wasn’t it deprecated for Python 3? Again this probably just comes down to preference again. I just print a final result of a program to stdout (which can be binary data, or some SVG, or just some lines of information). That has nothing to do with “logging”, IMHO.
I have to admit… compared to some older ruff I had on disk it now reports like double of “errors”. 99% of them irrelevant to actual issues. It’s over reporting silly things so much it has become useless to use. It may or may not report something critical between all the noise, but it’s hard to see the tree because of the forest, so to speak.
I guess this is that new “black” stuff?
If I was to make my code compatible to what it wants I couldn’t use/read it anymore. :) Probably my programs would stop working too:
I guess I have to comment that out.
Oups. I guess I just
rm *.py
to fix the madness. 😎Or you can just configure it in your pyproject.toml if you don’t want certain lints
My projects are usually just standalone scripts, so no pyproject.toml.
I use a global “.pylintrc” in my home directory for pylint, which I occasionally copy over to project folders that get synced to public github repositories, but that’s it.
Personally I would prefer this to be just the .py file, not all the other fluff one needs to add: https://github.com/the-real-tokai/grablinks
I think that one off standalone scripts are probably not the use case linters (especially ones like ruff that prioritize speed on large code bases) have in mind
It sounds like you’re running it with all the rules enabled, which you don’t have to do and IIRC isn’t the default
I only experimented with it briefly (the old version and the new version I downloaded today). I don’t remember configuring anything, so I assume it runs like that by default:
Certainly this will become more useful toned down to sane limits, but it needs time/ research/ reading lots of documentation(?) to sort that out. A more sane default would be nice, IMHO.
This is not the default at all the default is very few corrections by default
That’s interesting.
After some digging I found a “ruff.toml” in an unusual place for a unix’y command line tool (
~/Library/Application Support/ruff/ruff.toml
)I don’t know what put it there, certainly not my doing as far as I can remember. But that explains some things, I guess. 😱
If your project has a significant enough scope that a tool like ruff is warranted, you really should have proposer logging setup instead of print statement, and you should be relying on your version control instead of commenting out code.
You enable all Rules on a personal project? Why?
Anyway time for you to get some humbleness and realize the fault lies with the person in the chair. You. Not even reading the first page of the documentation or following it learning best practices to pick or not pick. Then coming a making an obviously uninformed comment.
https://en.m.wiktionary.org/wiki/PEBCAK
Btw both of those seem like useful errors.
sounds like you haven’t learned most of what is being taught by the greats such as Uncle Bob and his clean code talks.
print() in almost every case should probably be logger.log() if it is important.
comments, doc strings aside, are usually (almost always?) a “code smell”.
“Clean code” is always about preference. I like code I can read and understand. If I want extra comments or keep some commented code to make a thought process about a coding decision more clear then that’s not a bad thing, IMHO.
And if
print()
is such a bad thing, why wasn’t it deprecated for Python 3? Again this probably just comes down to preference again. I just print a final result of a program to stdout (which can be binary data, or some SVG, or just some lines of information). That has nothing to do with “logging”, IMHO.I don’t know who Uncle Bob is. 😳
most linting suggestions are pointless that’s nothing unusual