GH-License icon indicating copy to clipboard operation
GH-License copied to clipboard

Code refactoring

Open Mte90 opened this issue 3 years ago • 3 comments

The code on https://github.com/Mte90/GH-License/blob/master/ghlicense/cmd.py is too long and probably is better to split in various files.

Mte90 avatar Mar 11 '22 18:03 Mte90

I'll gladly do many changes, with among them (order not important)

  • [x] Refactor all strings concatenation to f-strings : not very useful, but quick win for motivation
  • [ ] Flake8 and some linting
  • [ ] Revamp report creation : instead of creating a file throughout the script, make a main dictionnary that stores information then use a separate function to deal with report file creation
  • [ ] Separate the 3 main branch of the command line in 3 different files to differ them
  • [ ] Use progressbar library to replace current workaround : https://github.com/WoLpH/python-progressbar
  • [ ] Minimal testing cover : don't know how to proceed yet, since it needs dummies GitHub or BitBucket users/organizations to test all possible cases

Thoughts @Mte90 ?

Dynnammo avatar Oct 03 '22 20:10 Dynnammo

I agree with everything, just about tests we have the ticket https://github.com/Mte90/GH-License/issues/34

If we can simplify and organize it better it will be simpler to add new things and supports for other services.

Mte90 avatar Oct 04 '22 09:10 Mte90

Reading the code I think that https://github.com/Mte90/GH-License/blob/master/ghlicense/cmd.py#L348

This section will be better if we switch to a switch case or to an array

Mte90 avatar Oct 10 '22 20:10 Mte90