pyproject-fmt icon indicating copy to clipboard operation
pyproject-fmt copied to clipboard

Prioritisation of "favorite" tools

Open jamesmyatt opened this issue 2 years ago • 1 comments

Thanks for this. However, I'm not sure I like the logic to move some blessed or favorite tools to the start of the tools section: https://github.com/tox-dev/pyproject-fmt/blob/a511b082b5f9d17ef18cd0719a3c1b457a3c1c6d/src/pyproject_fmt/formatter/tools.py#L29.

I feel like it makes it harder to find the section you're after rather than easier (Does "ruff" come before or after "isort"?). Also opens the questions of why one tool is blessed and another isn't (Why is "flake8" special and "pylint" isn't?), and makes more work for you to decide when to add (or remove) new tools to this list of favorites.

I think it's actually done to try to keep the tables for similar types of tool together, e.g. build, packaging, formatting, linting, unit testing, type checking, and that's a noble aim. But for me, a simple alphabetical order with no exceptions is going to be easiest for everyone to understand and avoid the most work for you.

Whatever you choose to do (in the end it's your project), please can you make it clear what's happening and why in the documentation (and code) and how you intend to evolve this over time (e.g. adding tools to the list)? I wonder if my strength of feeling on this is linked to the amount of surprise I had looking at the output.

In the longer-term, perhaps a configuration option to specify this list would be ideal (c.f. isort sections), since I don't think you'll ever satisfy everyone completely.

jamesmyatt avatar Sep 11 '23 10:09 jamesmyatt

I'm always happy to accept now tools in that ordering. My ordering logic is:

  • packaging backend (above this is the standardized packaging configs, so makes sense to keep close),
  • linters/formatters,
  • test configuration,
  • type checkers.

Within a such section the order is personal preferance (influenced by popularity of those tools).

In the longer-term, perhaps a configuration option to specify this list would be ideal (c.f. isort sections), since I don't think you'll ever satisfy everyone completely.

I don't plan to. This is an opinionated formatter, just like black is.

I think it's actually done to try to keep the tables for similar types of tool together, e.g. build, packaging, formatting, linting, unit testing, type checking, and that's a noble aim. But for me, a simple alphabetical order with no exceptions is going to be easiest for everyone to understand and avoid the most work for you.

I mean that would but some tools before the project or build-backend sections which I'm not sure is wise. Perhaps pinning those two should still happen, but I'd be OK to accept a PR that adds alphabetical ordering.... but nothing more.

gaborbernat avatar Sep 11 '23 14:09 gaborbernat