Use ruff instead of flake8 - #2198
Conversation
webknjaz
left a comment
There was a problem hiding this comment.
Please keep the config in .ruff.toml. Mimick the shape I have in Cheroot. It is important to be able to sync configs across projects with minimal diff.
Additionally, the hook might need extra args to actually fail on violations, IIRC.
Also, are you sure this covers all flake8 rules?
| markers = ["network: mark tests that require internet access"] | ||
|
|
||
| [tool.ruff] | ||
| line-length = 100 |
There was a problem hiding this comment.
Urgh.. I don't like this accessibility-unfriendly length but I suppose we can fix it later.
There was a problem hiding this comment.
I also dislike this. I've kept this PR in line with existing settings, we can review them as a follow-up.
I'll also switch over isort in a separate PR to keep reviews simpler.
Why prefer a dotfile instead of the regular pyproject.toml? The latter is the more common approach, standard in the ecosystem, and doesn't hide settings.
I don't know what this is or what this means.
Fixed. Completely forgot about this.
Yes. The ruff docs state:
I added explicit configuration for the flake8-pytest rules. |
It's unusual in my projects to dump everything into one file because it's super inconvenient. Many projects still have their own configs because it's problematic. https://blog.jaraco.com/skeleton/#updating
Imagine having tens or hundreds of projects where you need to make the same updates. If the files are small and separate, you can use diff mode in the editor or copy files right away. When bits of files diverge across the repos, making updates using diff mode isn't that difficult. But one's multiple intertwined reformatted and reordered sections appear on the same file, it's always nightmare, multiplied by the number of projects. Having dedicated files makes it easier to find where things are and reduce the drift-related friction so much that I find it utterly unacceptable to dump everything into the |
webknjaz
left a comment
There was a problem hiding this comment.
I think that to be equivalent to flake8, we need to enable its rule categories. I don't really trust ruff to do implicit magic with that.
|
All other projects to which I've contributed or have access use Personally, I find diff'ing a single file quicker than diff'ing a tree of lots of tiny files. I also dislike the idea of hiding this this kind of configuration in dotfiles, when the typical convention is to have them in a single, standard file. I don't have time or interest in making a snowflake configuration for this project that meet your requirements. If that is a blocker, feel free to close this. |
|
I am net-neutral towards I can conform my style to whatever a project needs, within reason, but Two thoughts which are all I'll say on the review front:
|
|
@sirosen there's no reason we can't take over the PR and move the config, even if Hugo does not want to be working on this himself. Evidently, we have different experiences and what seems right to him brings a lot of inconvenience to me. But given how I'd like to align multiple projects, the config location is a blocker at the moment. And yes, it seems difficult to me to evaluate linter replacements. I think I was adding ruff additionally w/o removing old things in my other projects. But there, I took a different approach of enabling all the rules and making exclusions, which would cover more things. |
|
If you're attempting to align multiple project, I suggest aligning to what the greater ecosystem is doing, rather than align them with a diverting approach. Eventually it's your call. |
Configure ruff to lint code performing the same validations as the existing flake8 setup.
See: #1886
Contributor checklist
Maintainer checklist
backwards incompatible,feature,enhancement,deprecation,bug,dependency,docsorskip-changelogas they determine changelog listing.