DocScoDoc/docs/Developpement.md

83 lines
2.5 KiB
Markdown
Raw Normal View History

2020-12-23 09:01:25 +01:00
## Développer sur ScoDoc 7
Quelques conseils, indications et mémos pour les développeurs sur ScoDoc version 7.x.
2021-01-24 21:08:18 +01:00
## Style et formatage du code
2020-12-23 09:01:25 +01:00
L'ancienneté de la base de code a rendu le style peu cohérent.
2021-01-24 21:08:18 +01:00
Le code doit être formatté avec [`black`](https://black.readthedocs.io/) avant tout commit (configurez votre éditeur pour appeler `black` à l'enregistrement).
2020-12-23 09:01:25 +01:00
2021-01-24 21:08:18 +01:00
### Documentation
On adopte le style "Google": <https://google.github.io/styleguide/pyguide.html#383-functions-and-methods>
Exemple:
"""Description résumée de la fonction
blah blah sur la fonction
Args:
table_handle: An open smalltable.Table instance.
keys: A sequence of strings representing the key of each table
row to fetch. String keys will be UTF-8 encoded.
require_all_keys: Optional; If require_all_keys is True only
rows with values set for all keys will be returned.
Returns:
A dict mapping keys to the corresponding table row data
fetched. Each row is represented as a tuple of strings. For
example:
{b'Serak': ('Rigel VII', 'Preparer'),
b'Zim': ('Irk', 'Invader'),
b'Lrrr': ('Omicron Persei 8', 'Emperor')}
"""
## Git
2020-12-23 09:01:25 +01:00
Le dépot est <https://scodoc.org/git/viennet/ScoDoc>
La branche `master` est celle en production. La branche `Scodoc8`est expérimentale (nouvel installeur, refactoring...). ScoDoc9 sera avec Python 3.
2021-01-24 21:08:18 +01:00
### Hot fixes (internes)
2020-12-23 09:01:25 +01:00
Pour les développeurs internes (écriture sur le dépot master):
# Créer une branche
# si besoin (travail en cours), utiliser git stash avant
git checkout master
git branch hotfix
git checkout hotfix
... dev, test ...
git add ...
git commit -m "fixed ..."
git checkout master
git merge hotfix
git branch -d hotfix
# publication
# éventuellement: git stash pop
2021-01-24 21:08:18 +01:00
### Mettre à jour votre branche
2020-12-23 09:01:25 +01:00
2021-01-24 21:08:18 +01:00
Vous travaillez dans votre branche `ma_branche`. Pour lui appliquer les mises à jour de `master` (remote):
2020-12-23 09:01:25 +01:00
git pull origin master
2021-01-24 21:08:18 +01:00
### Commandes utiles, en vrac
* `git log -L:fonction_python:fichier.py`
2020-12-23 09:01:25 +01:00
### Refactoring
pylint --disable=all -e E sco_parcours_dut.py | grep undefined-variable | awk '{print $4;}' | sort | uniq | tr -d \'
2021-01-24 21:08:18 +01:00
Lint tous les fichiers modifiés:
git status | grep modified | grep .py | awk '{print $2}' | xargs pylint -E
Restore les modes au besoin (SAMBA les changent parfois):
git diff -p -R --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply
## Portail pour tests
TODO