qomui icon indicating copy to clipboard operation
qomui copied to clipboard

DIR-variables code style suggestions

Open Hofer-Julian opened this issue 5 years ago • 6 comments

I noticed that you set the same global variables at multiple places of the your python scripts (like e.g. ROOTDIR).

I would suggest to put them in seperate file (e.g. config.py) and import them from there.

I would also suggest to make use of QStandardPaths, instead of hardcode them (especially if you want to target different distributions in the future). The config path for example could be obtained with:

from PyQt5 import QtCore
config_path = QtCore.QStandardPaths.writableLocation(QtCore.QStandardPaths.ConfigLocation)

I can open a pull request if you want to.

Hofer-Julian avatar Feb 27 '19 09:02 Hofer-Julian

You're right, that's really ugly. Both have been on my to-do-list for a while. It's about time.

corrad1nho avatar Feb 27 '19 18:02 corrad1nho

That is good hear :)

Another thing that just occured to me: Do you currently use some kind of linter like flake8? To set one as a standard linter for your project would allow contributers to maintain a consistent coding style.

Hofer-Julian avatar Feb 27 '19 18:02 Hofer-Julian

Frankly, I haven't really used linting a lot. Qomui has started as a total beginner's project and the inconsistencies within the code as I realize reflect that. So there's a lot of things to clean up. I'm really glad for your suggestions. What would be a good/common way to set a standard linter?

corrad1nho avatar Feb 27 '19 19:02 corrad1nho

Well, as a start you could include this into your Readme:

To test for style errors:

$ flake8

Hofer-Julian avatar Feb 27 '19 19:02 Hofer-Julian

Also, I didn't manage to install a local development setup for qomui. It would be nice to have a deterministic way to install qomui in a virtual environment.

Personally I really like contribution-guides like this one: https://github.com/borgbase/vorta/blob/351b8370a7ebdb853e0864186b40c96c731f275e/CONTRIBUTING.md

Hofer-Julian avatar Feb 27 '19 19:02 Hofer-Julian

Thanks, I'll have a look at that!

corrad1nho avatar Feb 27 '19 19:02 corrad1nho