Skip to content

Commit 613145b

Browse files
committed
Adicionando typos ao pyproject
closes #500
1 parent 9ea3f47 commit 613145b

18 files changed

Lines changed: 68 additions & 9 deletions

aulas/01.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,20 @@ error: `messsage` should be `message`
536536

537537
Nos dizendo que a string contida na linha `#!py 8` coluna `#!py 14` tem um erro: `messsage` deveria ser `message`.
538538

539+
???+ warning "Como evitar em alguns arquivos?"
540+
Como falantes de português, nem sempre queremos escrever coisas como a documentação em português. Ou mesmo o README.md na base do repositório.
541+
542+
Para ignorar o typos em determinados arquivos, poderiamos fazer algo parecido com isso:
543+
544+
```py title="pyproject.toml"
545+
[tool.typos.files]
546+
extend-exclude = ["*.md"] #(1)!
547+
```
548+
549+
1. Aqui todos os arquivos (`*`) com a extensão `.md` estão sendo ignorados
550+
551+
Dessa forma, podemos ignorar todos os arquivos em markdown, por exemplo.
552+
539553
### Taskipy
540554

541555
A ideia do [Taskipy](https://github.com/taskipy/taskipy){:target="_blank"} é ser um executor de tarefas (*task runner*) complementar em nossa aplicação. No lugar de ter que lembrar comandos como o do fastapi, que vimos na execução da aplicação, que tal substituir ele simplesmente por `task run`?

aulas/10.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ Se formos executar nosso `test_db`, ele falhará por dois motivos bastante difer
165165
╰╴ ━━━━━━━━
166166
```
167167

168-
Resolver essa situação é bastante simples. Criaremos na raiz do projeto um arquivo chamado `_typos.toml` e dizer que ele deve ignorar ocorrências da string `#!py 'selectin'`:
168+
Resolver essa situação é bastante simples. Criaremos em nosso `pyproject.toml` uma configuração do `typos` para dizer que ele deve ignorar ocorrências da exata string `#!py 'selectin'`:
169169

170-
```toml title="_typos.toml" linenums="1" hl_lines="2"
171-
[default]
170+
```toml title="pyproject.toml"
171+
[tool.typos.default]
172172
extend-ignore-identifiers-re = ["selectin"]
173173
```
174174

codigo_das_aulas/01/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ pre_test = 'task lint'
4646
test = 'pytest -s -x --cov=fast_zero -vv'
4747
post_test = 'coverage html'
4848

49+
[tool.typos.files]
50+
extend-exclude = ["*.md"]
51+
4952
[build-system]
5053
requires = ["poetry-core>=2.0.0,<3.0.0"]
5154
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/02/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ pre_test = 'task lint'
4646
test = 'pytest -s -x --cov=fast_zero -vv'
4747
post_test = 'coverage html'
4848

49+
[tool.typos.files]
50+
extend-exclude = ["*.md"]
51+
4952
[build-system]
5053
requires = ["poetry-core>=2.0.0,<3.0.0"]
5154
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/03/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ pre_test = 'task lint'
4646
test = 'pytest -s -x --cov=fast_zero -vv'
4747
post_test = 'coverage html'
4848

49+
[tool.typos.files]
50+
extend-exclude = ["*.md"]
51+
4952
[build-system]
5053
requires = ["poetry-core>=2.0.0,<3.0.0"]
5154
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/04/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ pre_test = 'task lint'
4949
test = 'pytest -s -x --cov=fast_zero -vv'
5050
post_test = 'coverage html'
5151

52+
[tool.typos.files]
53+
extend-exclude = ["*.md"]
54+
5255
[build-system]
5356
requires = ["poetry-core>=2.0.0,<3.0.0"]
5457
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/05/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ pre_test = 'task lint'
4949
test = 'pytest -s -x --cov=fast_zero -vv'
5050
post_test = 'coverage html'
5151

52+
[tool.typos.files]
53+
extend-exclude = ["*.md"]
54+
5255
[build-system]
5356
requires = ["poetry-core>=2.0.0,<3.0.0"]
5457
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/06/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pre_test = 'task lint'
5252
test = 'pytest -s -x --cov=fast_zero -vv'
5353
post_test = 'coverage html'
5454

55+
[tool.typos.files]
56+
extend-exclude = ["*.md"]
57+
5558
[build-system]
5659
requires = ["poetry-core>=2.0.0,<3.0.0"]
5760
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/07/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ pre_test = 'task lint'
5252
test = 'pytest -s -x --cov=fast_zero -vv'
5353
post_test = 'coverage html'
5454

55+
[tool.typos.files]
56+
extend-exclude = ["*.md"]
57+
5558
[build-system]
5659
requires = ["poetry-core>=2.0.0,<3.0.0"]
5760
build-backend = "poetry.core.masonry.api"

codigo_das_aulas/08/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ pre_test = 'task lint'
6161
test = 'pytest -s -x --cov=fast_zero -vv'
6262
post_test = 'coverage html'
6363

64+
[tool.typos.files]
65+
extend-exclude = ["*.md"]
66+
6467
[build-system]
6568
requires = ["poetry-core>=2.0.0,<3.0.0"]
6669
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)