Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/formatting2 #963

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ jobs:
gcloud --quiet config set compute/zone ${GOOGLE_COMPUTE_ZONE}
openssl aes256 -md md5 -d -in docker-compose.circleci.yaml.enc -out docker-compose.yml -pass pass:$CONFIG_PASSWORD
docker-compose up -d
- run:
name: Format with black
command: docker-compose run web black --check api
- run:
name: Format with isort
command: docker-compose run web isort --check --settings-path=api/setup.cfg api
- run:
name: Format with prettier
command: docker-compose run webapp yarn prettier-ci
- run:
name: Run migrations
command: |
Expand All @@ -22,7 +31,7 @@ jobs:
docker-compose run web python3 api/run.py db upgrade --directory api/migrations
- run:
name: Run unit tests
command: docker-compose run web nosetests -v
command: docker-compose run web nosetests -v

integration-tests:
machine:
Expand Down
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*]
end_of_line = lf
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
text=auto eol=lf

*.{png,pdf,ico,enc,jpg,jpeg,gif,webp,woff,woff2} binary
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ venv.bak/
.spyderproject
.spyproject

# VSCode project settings
.vscode


# IntelliJ/Pycharm/Webstorm/etc. project settings
.iml

Expand Down
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"editorconfig.editorconfig",
"ms-python.python",
"esbenp.prettier-vscode"
]
}
28 changes: 28 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"python.sortImports.args": [
"--settings-path=${workspaceFolder}/api/setup.cfg"
],
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"[jsx-tags]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
},
"prettier.configPath": "./webapp/.prettierrc.json",
"prettier.ignorePath": "./webapp/.prettierignore",
"prettier.prettierPath": "./webapp/node_modules/prettier"
}
7 changes: 4 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ ENV PATH /env/bin:$PATH

RUN apt-get update -qq \
&& apt-get install -y software-properties-common \
&& apt-get install -y libreoffice
&& apt-get install -y libreoffice \
&& python3 -m pip install --upgrade pip

# Upgrade pip
RUN python -m pip install --upgrade pip

# Add the application source code.
ADD requirements.txt /code/requirements.txt
RUN pip3 install -r /code/requirements.txt
COPY requirements.txt requirements-dev.txt /code/
RUN pip3 install -r /code/requirements.txt -r /code/requirements-dev.txt

ADD . /code/
WORKDIR /code
Expand Down
2 changes: 2 additions & 0 deletions api/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
black==22.1.0
isort==5.10.1
2 changes: 2 additions & 0 deletions api/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[isort]
profile = black
26 changes: 26 additions & 0 deletions webapp/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# See https://prettier.io/docs/en/ignore.html for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Ignore md files
*.md
3 changes: 3 additions & 0 deletions webapp/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"endOfLine": "lf"
}
4 changes: 3 additions & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"test": "react-scripts test",
"eject": "react-scripts eject",
"test-ci": "react-scripts test --env=jsdom --ci --coverage -u",
"cypress": "cypress open"
"cypress": "cypress open",
"prettier-ci": "prettier --check ."
},
"eslintConfig": {
"extends": "react-app"
Expand All @@ -64,6 +65,7 @@
"devDependencies": {
"@babel/runtime": "^7.12.5",
"cypress": "^4.0.2",
"prettier": "2.6.0",
"react-test-renderer": "^16.14.0"
}
}
5 changes: 5 additions & 0 deletions webapp/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9162,6 +9162,11 @@ preserve@^0.2.0:
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
integrity sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=

prettier@2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.6.0.tgz#12f8f504c4d8ddb76475f441337542fa799207d4"
integrity sha512-m2FgJibYrBGGgQXNzfd0PuDGShJgRavjUoRCw1mZERIWVSXF0iLzLm+aOqTAbLnC3n6JzUhAA8uZnFVghHJ86A==

prettier@^1.14.2:
version "1.16.4"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.16.4.tgz#73e37e73e018ad2db9c76742e2647e21790c9717"
Expand Down