MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia
https://astroautomata.com/PySR
Apache License 2.0
2.32k stars 211 forks source link

[Feature]: Adding linting to pre-commit hooks #453

Open w2ll2am opened 11 months ago

w2ll2am commented 11 months ago

Feature Request

Choose a linter to use in the project. Adding this linter to the pre-commit hooks as the final stage. Remove isort as it's functionality would be covered by another linter.

Context

It was great to see the addition of pre-commit hooks to the project for consistent code formatting. Very handy to have automated formatting using black in this recent commit. Often in automated formatting is followed by automated linting and I feel the project could be improved by this addition. I can see isort has been added to manage imports, would you consider adding a linter with a more comprehensive suite of linting tests?

Decisions

Black has a guide on using black with linting tools, the two most popular are Pylint and Flake8. Flake8 is less comprehensive but has a suite of plugins to further extends its functionality. Pylint has a more comprehensive suite of linting tests included and has fewer conflicts with Black

Possible Problems

There can be some conflicts between the automated formatting between black and the linter. Worst case scenario these can be supressed, or the settings for black or the linter can be modified. In my experience, conflicts are often manageable and do indicate the need for a code structure change.

Responsibility

Adding this may incur other changes in the code base, so I understand if I would not be the best person to add this.

MilesCranmer commented 10 months ago

Hi @w2ll2am, Sounds great! If you want to add this in a PR I’d be happy to review it, Cheers, Miles