[ADD] documentation black, odoo-autopep8, prettier
This commit is contained in:
parent
924a450b9a
commit
8078b68261
8 changed files with 51 additions and 1 deletions
|
|
@ -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
|
||||
```
|
||||
|
|
|
|||
|
|
@ -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)" \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
6
script/maintenance/autopep8.sh
Executable 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
5
script/maintenance/black.sh
Executable 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
4
script/maintenance/prettier.sh
Executable 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 $@
|
||||
Loading…
Reference in a new issue