Skip to content

Commit

Permalink
Configurado Linter com Flake8
Browse files Browse the repository at this point in the history
close #6
  • Loading branch information
renzon authored and renzon committed Jul 10, 2024
1 parent c44f132 commit 7cfec75
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ jobs:
python -m pip install poetry
poetry install --with dev --sync
- name: Run Linter
run: poetry run flake8 .

- name: Run backend Tests
run: poetry run pytest --cache-clear
9 changes: 9 additions & 0 deletions backend/.flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[flake8]
exclude =
.git,
.venv,
__pycache__,
build,
dist
max-complexity = 10
max-line-length = 120
10 changes: 10 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ Então rode
python manage.py runserver
```

## Padrão de código
Para o backend esse projeto usa o flake8, com as seguintes customizações

Tamanho de linha pode ter até 120 caracteres. Para ver o relatório do linter rode:


```bash
flake8 .
```

2 changes: 1 addition & 1 deletion backend/devpro/base/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.contrib import admin
# from django.contrib import admin

# Register your models here.
2 changes: 1 addition & 1 deletion backend/devpro/base/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.db import models
# from django.db import models

# Create your models here.
5 changes: 0 additions & 5 deletions backend/devpro/base/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
from django.test import TestCase


# Create your tests here.

def test_fake():
assert True
2 changes: 1 addition & 1 deletion backend/devpro/base/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.shortcuts import render
# from django.shortcuts import render

# Create your views here.
51 changes: 50 additions & 1 deletion backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ optional = true
[tool.poetry.group.dev.dependencies]
pytest = "^8.2.2"
pytest-django = "^4.8.0"
flake8 = "^7.1.0"

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "devpro.settings"
Expand Down

0 comments on commit 7cfec75

Please sign in to comment.