[ADD] documentation black, odoo-autopep8, prettier

This commit is contained in:
Mathieu Benoit 2021-03-22 04:22:50 -04:00
parent 924a450b9a
commit 8078b68261
8 changed files with 51 additions and 1 deletions

View file

@ -139,3 +139,27 @@ Use this commit format:
```bash
git commit -am "[#ticket] subject: short sentence"
```
# Format code
## Python
Use [black](https://github.com/psf/black)
```bash
./script/maintenance/black.sh ./addons/TechnoLibre_odoo-code-generator
```
Or if you prefer [oca-autopep8](https://github.com/psf/black)
```bash
./script/maintenance/autopep8.sh ./addons/TechnoLibre_odoo-code-generator
```
## HTML and css
Use [prettier](https://github.com/prettier/prettier)
```bash
./script/maintenance/prettier.sh ./addons/TechnoLibre_odoo-code-generator
```
## Javascript
Use [prettier](https://github.com/prettier/prettier)
```bash
./script/maintenance/prettier.sh --tab-width 4 ./addons/TechnoLibre_odoo-code-generator
```

View file

@ -15,7 +15,7 @@ RUN apt-get update \
fonts-noto-cjk \
gnupg \
libssl-dev \
node-less \
node-less \
npm \
python3-num2words \
python3-pip \
@ -38,6 +38,8 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends ./wkhtmltox.deb \
&& rm -rf /var/lib/apt/lists/* wkhtmltox.deb
RUN npm i prettier
# install latest postgresql-client
RUN echo 'deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main' > /etc/apt/sources.list.d/pgdg.list \
&& GNUPGHOME="$(mktemp -d)" \

View file

@ -37,6 +37,11 @@ pylint-odoo
git+https://github.com/oca/pylint-odoo.git#egg=pylint-odoo
# oca-maintainers-tools
# git+https://github.com/OCA/maintainer-tools.git#egg=oca-maintainers-tools
xmlformatter
html5print
css-html-prettify
BeautifulSoup4
black
# For updating poetry
toml

View file

@ -35,6 +35,7 @@ echo "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
brew install nodejs npm openssl
sudo npm install -g rtlcss
sudo npm install -g less
sudo npm install -g prettier
yes n|pyenv install 3.7.7
pyenv local 3.7.7

View file

@ -55,6 +55,9 @@ sudo apt-get install nodejs npm -y
sudo npm install -g rtlcss
sudo npm install -g less
echo -e "\n---- Test tool ----"
sudo npm install -g prettier
sudo ln -fs /usr/local/bin/lessc /usr/bin/lessc
if [ ${EL_INSTALL_NGINX} = "True" ]; then

6
script/maintenance/autopep8.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
# This will format all python file
# argument 1: directory or file to format
NPROC=$(nproc)
source ./script/OCA_maintainer-tools/env/bin/activate
oca-autopep8 -j ${NPROC} --max-line-length 100 -ari $@

5
script/maintenance/black.sh Executable file
View file

@ -0,0 +1,5 @@
#!/usr/bin/env bash
# This will format all python file
# argument 1: directory or file to format
source ./.venv/bin/activate
black -l 100 -t py37 $@

4
script/maintenance/prettier.sh Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# This will format all js,css,html
# argument 1: directory or file to format
prettier --write $@