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

Pre-commit hook atualização de configurações #527

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
53 changes: 35 additions & 18 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,42 @@
exclude: 'docs|node_modules|.git|.tox'
default_stages: [commit]
fail_fast: true
exclude: '.git|.tox|migrations|brasilio/wsgi.py|docker'

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: master
rev: v3.4.0
hooks:
- id: trailing-whitespace
files: (^|/).+\.(py|html|sh|css|js)$

- repo: local
hooks:
- id: flake8
name: flake8
entry: flake8
language: python
types: [python]
args: ['--config=setup.cfg']
- id: black
name: black
entry: black .
language: python
types: [python]
args: ['--check', '-l', '120', '--exclude', 'docker']
- repo: local
hooks:
- id: autoflake
name: autoflake
entry: autoflake
language: python
types:
- python
args: [--in-place, --recursive, --remove-unused-variables, --remove-all-unused-imports]

- id: isort
name: "format imports with isort"
entry: isort
language: python
types:
- python
args: [--line-length=120]

- id: black
name: "format code with black"
entry: black
language: python
types:
- python
args: [--line-length=120]

- id: flake8
name: "lint code with flake8"
entry: flake8
language: python
types:
- python
args: [--config=setup.cfg]
7 changes: 7 additions & 0 deletions docs/dev-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ make run

Nosso arquivo [Makefile](https://github.com/turicas/brasil.io/blob/develop/Makefile) possui outras entradas que podem te ser úteis durante o processo de desenvolvimento.

### Utilizar Pre-commit hooks
Com o pre-commit hooks toda vez que um novo commit for feito durante o desenvolvimento será verificado se o código commitado está no formato ideal. Caso não esteja, será automaticamente corrigido gerando uma modificação com as correções. Para ativá-lo o comando é:

```
pre-commit install
```

### Padrões de arquivos de apps

O projeto segue alguns padrões de organização dos arquivos das apps Django. Mais especificamente em relação aos arquivos estáticos, templates e de testes.
Expand Down
3 changes: 2 additions & 1 deletion requirements-development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
autoflake==1.3.1
black==19.10b0
flake8==3.7.9
isort==4.3.21
isort==5.8.0
model-bakery==1.1.0
pytest-django==3.2.1
pytest-env==0.6.2
pytest==4.4.1
pre-commit==2.12.0