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

Configurado Linter com Flake8 #12

Merged
merged 1 commit into from
Jul 10, 2024
Merged
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
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
Loading