tpaviot / ProcessScheduler

A Python package for automatic and optimized resource scheduling
https://processscheduler.github.io/
GNU General Public License v3.0
59 stars 17 forks source link

[Suggestion] Using Sourcery #85

Closed dreinon closed 3 years ago

dreinon commented 3 years ago

I suggest looking into Sourcery, a tool that I recently discovered and that works super nice in helping you to write better and cleaner code.

It suggests you refactors to make the code cleaner and more readable, and also rates your methods in the following way: image

They have plugins for github too.

tpaviot commented 3 years ago

ok thank you for the pointer, I didnt' know about this new tool. I will add a github hook, let's see the output

tpaviot commented 3 years ago

Here is the sourcerly PR for master branch refactoring

https://github.com/tpaviot/ProcessScheduler/pull/86

interesting indeed

dreinon commented 3 years ago

right, very interesting, what's your opinion about it? IMO, it's worth applying the PR changes since they are automatic, and it is also worth starting using sourcery to make cleaner code, although I would not spend the huge amount of time that refactoring all the current methods would need to increase sourcery score.

tpaviot commented 3 years ago

right, we already are using many different tools related to software quality. The processscheduler code is not that bad so far. Running sourcery from time to time as I did, by requesting the refactoring of a branch, is enough IMO.

dreinon commented 3 years ago

I agree. Although, it might be interesting starting to use it directly in the editor. I don't know which editor you use but sourcery is available for PyCharm and VSCode, and for Vim and Sublime in BETA.

tpaviot commented 3 years ago

SublimeText.

dreinon commented 3 years ago

https://github.com/sourcery-ai/sourcery/wiki/Sublime-Usage

dreinon commented 3 years ago

Testing the code in my editor, I see black has done an awesome job and that it works pretty nicely :) Although, there are some small things that still appear in my editor like the following: image

It's no big deal but it would be nice to have flake8 checking these things. I found a github action ready to go here and a plugin for sublime in case you were interested too here.

Thanks!

tpaviot commented 3 years ago

Some of them are false positives. linters are confused by the z3 semantics. For example, the z3 assertion x == False is an assignment whereas python understands it as a comparison. I use the linters just to check issues I could have missed, the objective is not really to get en empty report.

Le jeu. 29 juil. 2021 à 11:13, dreinon @.***> a écrit :

Testing the code in my editor, I see black has done an awesome job and that it works pretty nicely :) Although, there are some small things that still appear in my editor like the following: [image: image] https://user-images.githubusercontent.com/67071425/127465149-0f2e918d-7405-4ce0-ab21-ca6a4e566119.png

It's no big deal but it would be nice to have flake8 checking these things. I found a github action ready to go here https://github.com/marketplace/actions/flake8-action and a plugin for sublime in case you were interested too here https://github.com/SublimeLinter/SublimeLinter-flake8.

Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tpaviot/ProcessScheduler/issues/85#issuecomment-888948317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFBFIVJIXU442HHAZCZ7A3T2ELSXANCNFSM5BEHMHWQ .

dreinon commented 3 years ago

Right, I understand! Should I close this issue?

tpaviot commented 3 years ago

Yes, please