cavalab / srbench

A living benchmark framework for symbolic regression
https://cavalab.org/srbench/
GNU General Public License v3.0
219 stars 79 forks source link

Adopt ruff (or other linter) #193

Open alcides opened 1 week ago

alcides commented 1 week ago

Different contributors have different code styles. The recommended approach to handle this is to have a pre-commit/CI step that validates that the source code follows some style.

For Python, I have been using ruff, that automatically fixes many issues, and detects code smells.

If you think it's useful, I can prepare a PR. But I don't think I should spend the time if you do not think it's worthwhile.

folivetti commented 1 week ago

I particularly like this idea. It would probably not be that useful for the regressor.py files since they are quite small and template based, but for any code contribution we may have in the future (i.e., experiments, analysis, plotting scripts). And since we are going to modify many of the scripts, I would go for it.

What do you think @gAldeia @lacava ?

gAldeia commented 1 week ago

Hi @alcides,

The idea sounds interesting! To be honest, I've been wanting to use ruff for a while but haven't had the chance to do so.

@folivetti, even though the changes to regressor.py are small, it could help ensure everything is working as expected.

That said, creating a new CI for ruff might not run smoothly. I think it is likely that several stuff will need fixing to pass the tests, and I'm not sure how much time you have to deal with it.

folivetti commented 1 week ago

fair point, it would possibly make things stop passing the tests right now and it wouldn't be wise to do it at this moment.

But I guess @alcides could do it and open a PR that we can merge after the benchmark is done (or maybe do it at a later moment if he's too busy right now).

alcides commented 1 week ago

The main problem with the proposed change is that it will result in a huge commit that touches everything. This is aweful for people who are working on their branches/forks.

My proposal is to do this (probably after the competition), when no-one is actively working on branches. It is not worthwhile to do it before hand.

folivetti commented 6 days ago

I agree!! We'll let you know when all the work in srbench seems to be finished. I'm looking forward to this (so I can "steal" to some other projects :-P ). Thanks @alcides !