houseabsolute / precious

One code quality tool to rule them all
Apache License 2.0
82 stars 4 forks source link

How to define the order in which tidiers are applied? #12

Closed oalders closed 2 years ago

oalders commented 2 years ago

I apologize if I have missed this in the docs. I'd like to ensure that perlimports always runs before perltidy as the file may need to be tidied after the imports have been rewritten.

Is it possible to dictate an arbitrary order in which files get tidied when running precious tidy --all?

autarch commented 2 years ago

Right now I think the order is undefined, because the config is put into a Rust HashMap that I iterate over. But switching this to a Vec<(String, Command) would be pretty easy. Do you have any interest in making a PR?

oalders commented 2 years ago

That sounds like a fun project. I've read a bit of the Rust Book, but that's about it, so maybe this is a good place to start.

autarch commented 2 years ago

Looking at the code, this is a pretty trivial change. But it'd be good to add some tests to make sure that the config file order is preserved.

autarch commented 2 years ago

I realized there's a much simpler way to do this, which is to just use a drop-in ordered map replacement. I'm working on that now.

autarch commented 2 years ago

Done in v0.1.2