ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
12.59k stars 560 forks source link

Add styleguides to contributing.md #202

Closed Otto-AA closed 4 years ago

Otto-AA commented 6 years ago

I think it would be helpful to link the preferred styleguides (python, javascript, ...) and some styleguide checking tools (e.g. pylint) in the contributing.md

For javascript I'd recommend this comprehensive styleguide from airbnb and jslint. I am not so familiar with python, but I guess PEP 8 would be a good choice for this together with the pep 8 styleguide checker or pylint.

Of course, we can't enforce or even expect everyone to completely read these docs, but in the past I personally found it helpful to have a styleguide, where I can look up certain things.

johan-bjareholt commented 6 years ago

Agree

Our python code mostly follows pep8 but our JavaScript code is all over the place. We had a PR once which added jslint support on aw-webui but it was so broke it actually broke functionality so we had to roll it back. Should be pretty easy to automate this with travis.

ErikBjare commented 6 years ago

I should add that as much as I like PEP8 etc, I'm not very fond of strict a code style policy since it adds mental overhead when developing (imo) and limits contributors (who might be discouraged from having a PR blocked/delayed due to "bad style" and have to set up tooling for linting).

But I welcome the initiative to set up tooling for automatic linting and fixing, I just don't want to have checks in CI and the like.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ErikBjare commented 4 years ago

I still think we should do this, and with the Black Python linter/code-formatter we should be able to do this automatically (just like how Prettier does it for Javascript).

Otto-AA commented 4 years ago

If you want a style guide for javascript, I'd suggest standard. It is a pre-configured style guide, which means that it is super easy to add it to the project. It also supports automatically fixing style errors (npx standard --fix) and seems to be pretty popular.

ErikBjare commented 4 years ago

We currently have a working eslint + prettier config for aw-webui, and that isn't going to change anytime soon. Standard looks good, but it isn't designed for use with Vue.js.

I'm interested in properly documenting the fact that we use eslint + prettier for aw-webui and maybe start using Black for all the Python code.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.