tbillington / kondo

Cleans dependencies and build artifacts from your projects.
MIT License
1.75k stars 51 forks source link

Defer to 3rd party for removing artifacts #122

Open tbillington opened 3 months ago

tbillington commented 3 months ago

Some 3rd party project management tools include commands, or users add them by convention, that clean their workspace.

Eg Cargo will remove target, and users of Makefiles and other scripting tools may create their own "clean" command.

Should kondo defer to these tools?

I'm inclined to say yes, however there may be situations where kondo knows more about the artifacts than the specific tool. There also may be situations where the user has implemented a clean command that performs some specific actions that kondo can't reasonably mimic.

It's not obvious to me which path kondo should take. I am erring on the side of not depending on the 3rd party tools because:

That being said, it does make sense to defer to tools like Cargos clean command, since it is the standard for projects of that nature.

luiswirth commented 3 months ago

Interesting. I'm surprised that this is not what kondo is already doing. I have assumed that it did! I'm in favor of deferring the cleaning to other commands, as this keeps the code of kondo smaller and doesn't duplicate this logic that is already implemented in another program (like cargo).

tbillington commented 3 months ago

While attractive, there are issues involved with using the 3rd party option off the top of my head.

We could separate the tools into two categories. Category A would be standard tools in the ecosystem, such as Cargo and it's clean command, and category B being more "convention" based like your Makefile example.

In my opinion category A is a stronger option than category B, but still suffers from the "shell out" issues raised above.

This is further complicated by projects possibly having both a category A option (Makefile/justfile) and a category B option (being a Cargo project) 😅

The "best" option would be to allow the user to specify their preferred choice for a given project. Choices being kondo built in, category A, category B. For UX it would be ideal to allow kondo to "remember" the decision for a given project or project type.


Thanks for your comment, responding to it helped me think through the above!


I'm surprised that this is not what kondo is already doing

That's interesting to know! My assumption has been that people would assume the opposite, so that's informative :)