I added a new validation function.
Eu adicionei uma nova função de validação.Aula
Descrever mudanças em código
Nível: A2
Objetivo
Descrever mudanças em código usando verbos no past simple (added, removed, updated, renamed, refactored, deleted, moved) referindo-se a arquivos e funções, e redigir um resumo simples de pull request.
Explicação
Em um resumo de pull request ou em uma mensagem de commit, as ações são descritas no passado com verbos específicos para cada tipo de mudança:
| Tipo de mudança | Verbo típico |
|---|---|
| criar algo novo | `added`, `created` |
| apagar algo | `removed`, `deleted` |
| alterar algo existente | `updated`, `changed`, `fixed` |
| trocar o nome | `renamed` |
| reorganizar sem mudar comportamento | `refactored` |
| mover de lugar | `moved` |
O padrão é curto: `sujeito + verbo no past + objeto`. Em PRs em primeira pessoa, o sujeito é geralmente `I` ou `We`:
- `I added a logout button to the header.`
- `I removed the deprecated ` + "`" + `getUserData` + "`" + ` function.`
- `We updated the error message in ` + "`" + `checkout.js` + "`" + `.`
- `I renamed ` + "`" + `handleClick` + "`" + ` to ` + "`" + `handleConfirm` + "`" + `.`
- `I refactored the validation block in ` + "`" + `utils.js` + "`" + `.`
Ao se referir a arquivos, funções e variáveis, use o nome exato do código entre crases e mantenha a forma como ele aparece no projeto: `the ` + "`" + `validateInput` + "`" + ` function`, `the ` + "`" + `auth.js` + "`" + ` file`, `the ` + "`" + `count` + "`" + ` variable`.
Um resumo de pull request curto segue a estrutura `This PR + verbo + resumo do que mudou + onde`. Pode listar mais de uma mudança separadas por `and` ou usar bullet points simples:
- `This PR adds a logout button and updates the header styles.`
- `This PR renames ` + "`" + `handleClick` + "`" + ` to ` + "`" + `handleConfirm` + "`" + ` and removes an unused function.`
- `This PR fixes the empty-cart bug in ` + "`" + `cart.js` + "`" + `.`
Em PRs e descrições de commit, o tempo verbal é consistentemente o passado simples para descrever o que já foi feito no branch.
Exemplos
| Inglês | Tradução | Observação |
|---|---|---|
| I added a logout button to the header. | Eu adicionei um botão de logout ao cabeçalho. | Added introduz algo novo. |
| I removed the deprecated `getUserData` function. | Eu removi a função `getUserData` obsoleta. | Removed apaga algo; o nome do código fica entre crases. |
| I renamed `handleClick` to `handleConfirm`. | Eu renomeei `handleClick` para `handleConfirm`. | Renamed usa o padrão `renamed X to Y`. |
| I refactored the validation logic in `utils.js`. | Eu refatorei a lógica de validação em `utils.js`. | Refactored indica reorganização interna. |
| This PR updates the checkout button label and renames one function. | Este PR atualiza o rótulo do botão de checkout e renomeia uma função. | Resumo de PR com this PR + verbo no passado + and. |
| I moved the helper to `src/utils/`. | Eu movi o helper para `src/utils/`. | Moved indica mudança de local, geralmente para um caminho. |
Erros comuns
- Usar o presente em vez do passado: `I add a function` deve ser `I added a function` em PRs e commits.
- Esquecer o `to` em `renamed X to Y`: `I renamed the function ` + "`" + `fetchUser` + "`" + ` ` deve ser seguido de `to ` + "`" + `getUser` + "`" + `.
- Confundir `updated` (mudou algo existente) com `added` (criou algo novo): se o item já existia, use `updated`, não `added`.
- Escrever nomes de código em português: mantenha `file`, `function`, `variable` em inglês, mesmo com substantivos PT nas descrições.
- Misturar tempos no mesmo resumo: `This PR adds X and fixed Y` deve ser `This PR adds X and fixes Y` ou `This PR added X and fixed Y`.
Prática guiada
Reescreva cada resumo usando o verbo correto no past simple:
- Criar um botão novo → `I ___ a new button.`
- Trocar o nome de uma função → `I ___ ` + "`" + `oldName` + "`" + ` to ` + "`" + `newName` + "`" + `.`
- Apagar código que ninguém usa → `I ___ the unused function.`
- Melhorar a estrutura sem mudar o comportamento → `I ___ the validation block.`
Observe que cada verbo descreve um tipo diferente de mudança: adicionar, renomear, remover, refatorar.
Resumo
Use verbos no past simple específicos para cada tipo de mudança: added, removed, updated, renamed, refactored, moved. Mantenha o nome do código entre crases e siga o padrão `This PR + verbo + resumo + local` no PR.
Vocabulário
Palavras principais
I removed the legacy import.
Eu removi o import legado.I updated the README with the new steps.
Eu atualizei o README com os novos passos.I renamed `fetchData` to `loadData`.
Eu renomeei `fetchData` para `loadData`.I refactored the payment module.
Eu refatorei o módulo de pagamento.I moved the helper to `src/utils/`.
Eu movi o helper para `src/utils/`.I deleted the unused test file.
Eu deletei o arquivo de teste não usado.I changed the file `api.js`.
Eu alterei o arquivo `api.js`.The `validateInput` function returns a boolean.
A função `validateInput` retorna um booleano.I renamed the variable from `cnt` to `count`.
Eu renomeei a variável de `cnt` para `count`.I added a new parameter to the function.
Eu adicionei um novo parâmetro à função.I refactored the authentication module.
Eu refatorei o módulo de autenticação.I removed the deprecated `oldHelper`.
Eu removi o `oldHelper` obsoleto.I opened a pull request with the changes.
Eu abri um pull request com as mudanças.I created a new branch called `fix/login`.
Eu criei um novo branch chamado `fix/login`.We merged the branch into `main`.
Nós fizemos merge do branch em `main`.This PR adds a dark mode toggle.
Este PR adiciona um alternador de modo escuro.I renamed `onClick` to `handleClick`.
Eu renomeei `onClick` para `handleClick`.História
História: Descrever mudanças em código
Nível: A2
História em inglês
The checkout button fix
Last Tuesday, Nina opened a new branch called `fix/checkout-button` to work on a small UI issue. She read the existing component and found an outdated label in `CheckoutButton.jsx`. Before she changed anything, she investigated the issue and ran the local tests. When did the bug start? She found a recent ticket that mentioned the new checkout flow. She made a short plan: update the label, rename one function, and remove an unused helper. Did she ask for a review before merging? No, she didn't — she wanted to finish the PR first.
The pull request summary
Nina updated the button label in `CheckoutButton.jsx` and changed its color. She renamed `handleClick` to `handleConfirm` so the name matched the new behavior. She also removed the deprecated `legacyClick` function and deleted the related test. Then she refactored the validation block in `cart.js` to make it easier to read. She wrote the pull request summary: "This PR updates the checkout button label, renames `handleClick` to `handleConfirm`, removes the deprecated `legacyClick` function, and refactors the validation block." A teammate reviewed the changes, didn't find any issues, and the team merged the branch and deployed the fix.
Tradução linha por linha
| Inglês | Tradução |
|---|---|
| Last Tuesday, Nina opened a new branch called `fix/checkout-button` to work on a small UI issue. | Na terça passada, Nina abriu um novo branch chamado `fix/checkout-button` para trabalhar em um pequeno problema de UI. |
| She read the existing component and found an outdated label in `CheckoutButton.jsx`. | Ela leu o componente existente e encontrou um rótulo desatualizado em `CheckoutButton.jsx`. |
| Before she changed anything, she investigated the issue and ran the local tests. | Antes de mudar qualquer coisa, ela investigou o problema e executou os testes locais. |
| When did the bug start? She found a recent ticket that mentioned the new checkout flow. | Quando o bug começou? Ela encontrou um ticket recente que mencionava o novo fluxo de checkout. |
| She made a short plan: update the label, rename one function, and remove an unused helper. | Ela fez um plano curto: atualizar o rótulo, renomear uma função e remover um helper não usado. |
| Did she ask for a review before merging? No, she didn't — she wanted to finish the PR first. | Ela pediu review antes do merge? Não, ela não pediu — ela queria terminar o PR primeiro. |
| Nina updated the button label in `CheckoutButton.jsx` and changed its color. | Nina atualizou o rótulo do botão em `CheckoutButton.jsx` e mudou a cor dele. |
| She renamed `handleClick` to `handleConfirm` so the name matched the new behavior. | Ela renomeou `handleClick` para `handleConfirm` para o nome combinar com o novo comportamento. |
| She also removed the deprecated `legacyClick` function and deleted the related test. | Ela também removeu a função `legacyClick` obsoleta e deletou o teste relacionado. |
| Then she refactored the validation block in `cart.js` to make it easier to read. | Em seguida, ela refatorou o bloco de validação em `cart.js` para ficar mais fácil de ler. |
| She wrote the pull request summary: "This PR updates the checkout button label, renames `handleClick` to `handleConfirm`, removes the deprecated `legacyClick` function, and refactors the validation block." | Ela escreveu o resumo do pull request: "Este PR atualiza o rótulo do botão de checkout, renomeia `handleClick` para `handleConfirm`, remove a função `legacyClick` obsoleta e refatora o bloco de validação." |
| A teammate reviewed the changes, didn't find any issues, and the team merged the branch and deployed the fix. | Um colega revisou as mudanças, não encontrou nenhum problema, e a equipe fez merge do branch e implantou a correção. |
Notas de vocabulário
- opened a new branch = expressão comum em git: criar um branch a partir do principal
- I read the existing component = ler o código antes de modificar; usei o verbo read no past simple
- I found an outdated label = found é o past simple de find; usei para localizar um problema
- I updated the button label = updated descreve mudança em algo que já existia
- renamed `handleClick` to `handleConfirm` = padrão clássico de rename: renamed X to Y
- removed the deprecated function = removed apaga; deprecated indica que algo estava marcado para remoção
- refactored the validation block = refactored indica reorganização sem mudar o comportamento externo
- This PR … = abreviação de pull request; o resumo começa com This PR + verbo
Perguntas de compreensão
- What kind of branch did Nina open to start her work?
- What did Nina find when she read the component?
- Why did Nina rename `handleClick` to `handleConfirm`?
- Which function did Nina remove from the project?
- What did the pull request summary mention about the validation block?
- Did the teammate find any issues in the review?
Prática com a história
- Resuma: Nina adicionou um campo de busca, renomeou `getResults` para `fetchResults` e removeu uma função não usada.
- Reescreva no past simple: I rename the helper to `loadConfig`.
- Classifique a mudança: I removed an unused import from `app.js`.
- Faça uma pergunta com when sobre a criação do branch.
Prática
Exercícios e teste
A próxima melhoria é transformar esses arquivos em perguntas com resposta no navegador. Por enquanto, esta página já organiza o estudo e permite seguir a aula inteira sem abrir os arquivos manualmente.