Skip to content

Commit

Permalink
Apply prettier and remove it for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Sassoulas committed May 30, 2021
1 parent b885522 commit ed1890b
Show file tree
Hide file tree
Showing 5 changed files with 167 additions and 168 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ jobs:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y texlive-latex-base gettext texlive-pictures texlive-latex-extra texlive-xetex libblas-dev liblapack-dev libatlas-base-dev gfortran
pip3 install --editable ".[dev]"
- name: Lint
run: |
pre-commit run --all-files
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 manage.py test
coverage run --source=survey --omit=survey/migrations/* ./manage.py test
coverage html
coveralls debug --service=github
- uses: actions/checkout@v2
- name: Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install -y texlive-latex-base gettext texlive-pictures texlive-latex-extra texlive-xetex libblas-dev liblapack-dev libatlas-base-dev gfortran
pip3 install --editable ".[dev]"
- name: Lint
run: |
pre-commit run --all-files
- name: Test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 manage.py test
coverage run --source=survey --omit=survey/migrations/* ./manage.py test
coverage html
coveralls debug --service=github
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ repos:
rev: 5.7.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.0
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
exclude: "survey/static/|dev/templates/|survey/templates/"
# - repo: https://github.com/pre-commit/mirrors-prettier
# rev: v2.3.0
# hooks:
# - id: prettier
# args: [--prose-wrap=always, --print-width=88]
# exclude: "survey/static/|dev/templates/|survey/templates/|survey/locale/"
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ jobs:
include:
- name: "Python 3.7.4 on macOS"
os: osx
osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4
language: shell # 'language: python' is an error on Travis CI macOS
osx_image: xcode11.2 # Python 3.7.4 running on macOS 10.14.4
language: shell # 'language: python' is an error on Travis CI macOS
before_install:
- brew cask install mactex
- brew install gettext
- brew link gettext --force
- name: "Python 3.8.0 on Windows"
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
before_install:
- choco install python --version 3.8.0
- choco install miktex.portable
- python -m pip install --upgrade pip
env: PATH=/c/Python38:/c/Python38/Scripts:$PATH
allow_failures:
- name: "Python 3.8.0 on Windows"
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
os: windows # Windows 10.0.17134 N/A Build 17134
language: shell # 'language: python' is an error on Travis CI Windows
before_install:
- choco install python --version 3.8.0
- choco install miktex.portable
Expand Down
85 changes: 41 additions & 44 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Django survey

A django survey app, based on and compatible with "django-survey".
You will be able to migrate your data from an ancient version of
django-survey, but it has been ported to python 3 and you can export results as
CSV or PDF using your native language.
A django survey app, based on and compatible with "django-survey". You will be able to
migrate your data from an ancient version of django-survey, but it has been ported to
python 3 and you can export results as CSV or PDF using your native language.

If you want the latest version still compatible with python 2.7 you need a
version < 1.3.0.
If you want the latest version still compatible with python 2.7 you need a version <
1.3.0.

Professional support for django-survey-and-report is available as part of the [Tidelift Subscription](https://tidelift.com/subscription/pkg/pypi-django-survey-and-report?utm_source=pypi-django-survey-and-report&utm_medium=referral&utm_campaign=enterprise)
Professional support for django-survey-and-report is available as part of the
[Tidelift Subscription](https://tidelift.com/subscription/pkg/pypi-django-survey-and-report?utm_source=pypi-django-survey-and-report&utm_medium=referral&utm_campaign=enterprise)

[![Build Status](https://travis-ci.org/Pierre-Sassoulas/django-survey.svg?branch=master)](https://travis-ci.org/Pierre-Sassoulas/django-survey)
[![Coverage Status](https://coveralls.io/repos/github/Pierre-Sassoulas/django-survey/badge.svg?branch=master)](https://coveralls.io/github/Pierre-Sassoulas/django-survey?branch=master)
Expand All @@ -18,25 +18,24 @@ Professional support for django-survey-and-report is available as part of the [T

## Table of contents

* [Contributing as a developer](#contributing-as-a-developer)
* [Development environment](#development-environment)
* [Committing code](#committing-code)
* [Launching tests](#launching-tests)
* [Adding test data](#adding-test-data)
* [Launching coverage](#launching-coverage)
* [Applying Lint](#applying-lint)
* [Translating the project](#translating-the-project)
* [As a developer](#as-a-developer)
* [As a translator](#as-a-translator)

- [Contributing as a developer](#contributing-as-a-developer)
- [Development environment](#development-environment)
- [Committing code](#committing-code)
- [Launching tests](#launching-tests)
- [Adding test data](#adding-test-data)
- [Launching coverage](#launching-coverage)
- [Applying Lint](#applying-lint)
- [Translating the project](#translating-the-project)
- [As a developer](#as-a-developer)
- [As a translator](#as-a-translator)

## Contributing as a developer

### Development environment

This is the typical command you should do to get started:

~~~~bash
```bash
python -m venv venv/ # Create virtualenv
source venv/bin/activate # Activate virtualenv
pip install -e ".[dev]" # Install dev requirements
Expand All @@ -45,58 +44,57 @@ python manage.py migrate # Create database
python manage.py loaddata survey/tests/testdump.json # Load test data
python manage.py createsuperuser
python manage.py runserver # Launch server
~~~~
```

Please note that `pre-commit` will permit to fix a lot of linting error
automatically and is not required but highly recommended.
Please note that `pre-commit` will permit to fix a lot of linting error automatically
and is not required but highly recommended.

### Committing code

#### Launching tests

~~~~bash
```bash
python manage.py test survey
~~~~
```

#### Adding test data

If you want to dump a test database after adding data to it, this is
the command to have a minimal diff :
If you want to dump a test database after adding data to it, this is the command to have
a minimal diff :

~~~~bash
```bash
python manage.py dumpdata --format json -e contenttypes -e admin -e auth.Permission
-e sessions.session -e sites.site --natural-foreign --indent 1
-o survey/tests/testdump.json
~~~~
```

#### Launching coverage

~~~~bash
```bash
coverage run --source=survey --omit=survey/migrations/* ./manage.py test
coverage html
xdg-open htmlcov/index.html
~~~~
```

#### Applying Lint

We're using `pre-commit`, it should take care of linting during commit.

## Translating the project

Django survey's is available in multiple language.
Your contribution would be very appreciated if you
know a language that is not yet available.
Django survey's is available in multiple language. Your contribution would be very
appreciated if you know a language that is not yet available.

### As a developer

If your language do not exists add it in the `LANGUAGE` variable in the
settings, like [here](https://github.com/Pierre-Sassoulas/django-survey/commit/ee3bdba26c303ad12fc4584938e724b39223faa9#diff-bdf3ecebd8379ca98cc89e545fc90899).
If your language does not exist add it in the `LANGUAGE` variable in the settings, like
[here](https://github.com/Pierre-Sassoulas/django-survey/commit/ee3bdba26c303ad12fc4584938e724b39223faa9#diff-bdf3ecebd8379ca98cc89e545fc90899).
Do not forget to credit yourself like in the header seen
[here](https://github.com/Pierre-Sassoulas/django-zxcvbn-password-validator/commit/274d7c9b27268a0455f80ea518c452532b970ea4#diff-8015f170326f20998060314fda9b92b1)

Then you can translate with :

~~~~bash
```bash
python manage.py makemessages
# python manage.py createsuperuser ? (You need to login for rosetta)
python manage.py runserver
Expand All @@ -107,17 +105,16 @@ python manage.py makemessages --no-obsolete --no-wrap --ignore venv
# --locale id --locale pt-br --locale pl" for version of django above 3
git add survey/locale/
...
~~~~
```

If your language is not yet available in rosetta,
[this stack overflow question](https://stackoverflow.com/questions/12946830/)
should work even for language not handled by django.
[this stack overflow question](https://stackoverflow.com/questions/12946830/) should
work even for language not handled by django.

### As a translator

If you're not a developer, open an issue on github and ask for a .po
file in your language. I will generate it for you, so you can edit it with an
online editor. I will then create the .po and commit them, so you can edit them
with your github account or integrate it myself if you do not have one.
You will be credited
If you're not a developer, open an issue on github and ask for a .po file in your
language. I will generate it for you, so you can edit it with an online editor. I will
then create the .po and commit them, so you can edit them with your github account or
integrate it myself if you do not have one. You will be credited
[here](https://github.com/Pierre-Sassoulas/django-survey#language-available).
Loading

0 comments on commit ed1890b

Please sign in to comment.