integreat-cms icon indicating copy to clipboard operation
integreat-cms copied to clipboard

Configure ruff import sorting and drop isort support

Open deen13 opened this issue 1 year ago • 10 comments

Short description

This pull request enables import sorting for ruff and tick some of the remaining boxes in #2442.

Side effects

While Ruff claims to be nearly equivalent to Isort when profile = "black", it formats the imports slightly differently. This pull request removes support for isort and deprecates black in our documentation to address the conflicting formatters.

Further Information: https://docs.astral.sh/ruff/faq/#how-does-ruffs-import-sorting-compare-to-isort


Pull Request Review Guidelines

deen13 avatar Apr 23 '24 13:04 deen13

Code Climate has analyzed commit 64ebd9dc and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 82.3% (0.0% change).

View more on Code Climate.

qlty-cloud-legacy[bot] avatar Apr 23 '24 13:04 qlty-cloud-legacy[bot]

I don't think tracking .vscode/ is a good idea. Could we do something like putting it into example-configs/ or otherwise renaming it but have it still feel intuitive (so you don't set up your whole project and notice at the very end that you could have based it on the default config)?

PeterNerlich avatar Apr 23 '24 13:04 PeterNerlich

Hey @PeterNerlich, I don't see any negative consequences in configuring the formatter and linter properly right away. When utilized, it ensures a consistent code style, which might not adhere to the default code settings, but the CI will ultimately ensure our code style anyway. Why do you think it's better not to change the default settings?

deen13 avatar Apr 23 '24 13:04 deen13

Hm, I'm with @PeterNerlich on this. Not sure we should be adding editor-specific configs. Wouldn't most people have set this up globally in their editor already anyways (and if not, probably prefer it that way)?

charludo avatar Apr 23 '24 13:04 charludo

My concern was mostly about some user changing settings and then accidentally committing them to the project. This wouldn't happen if the config in the repo was under some other name (like vscode.example/) that you'd copy to .vscode in order to use and maybe customize further – any changes to the example would have to be deliberate by design (except if you use symlinks, but then that's your own fault)

PeterNerlich avatar Apr 23 '24 14:04 PeterNerlich

I think it's unlikely for someone to change the file by accident because changes made in Visual Studio Code are not written to the settings.json. I agree with you that it feels weird to commit dotfiles, but in this case, it adds value to the developer experience and onboarding. Let me know if I've overlooked any cases where having the file would be problematic. 🙈

deen13 avatar Apr 23 '24 14:04 deen13

I have an idea for a tradeoff. How about removing it from here and adding it to the devcontainer configuration, as it already contains some ruff related stuff? @PeterNerlich @charludo

deen13 avatar Apr 23 '24 16:04 deen13

I have an idea for a tradeoff. How about removing it from here and adding it to the devcontainer configuration, as it already contains some rough-related stuff? @PeterNerlich @charludo

Sounds like a good idea to me!!

charludo avatar Apr 24 '24 05:04 charludo

Are you recommending the use of Ruff extension for Visual Studio Code?

  • https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff

cclauss avatar Apr 29 '24 09:04 cclauss

Are you recommending the use of Ruff extension for Visual Studio Code?

  • https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff

@cclauss yep it is predefined in our setup for code users

deen13 avatar Apr 30 '24 07:04 deen13