Use shellcheck for bats tests without workaround
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- bash
- Ambito
- testing-qa, tooling
Direzione di ricerca
Find the repository's .bats files and inspect their current shellcheck workaround and test declaration syntax. Check the linked shellcheck and Bats guidance before changing anything, since the issue depends on the shellcheck regression being resolved. Done means the workaround is removed, tests use @test notation, and shellcheck runs without the described false positives.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Unfortunately, the shellcheck+bats situation is a bit messy right now. Once they get things in order again, we can refactor our bats bash tests:
- Remove the workaround for the warnings about the
$output/$status/$linesvariables (see below) - Use the
@testprefix notation instead of the#@testcomment notation.- I.e.,
@test test_some_command() {instead oftest_some_command() { #@test
- I.e.,
Backstory / Workaround
shellcheck has built-in support for .bats files, even if these files use the (otherwise non-standard) @test prefix. However, there was a regression in shellcheck, where shellcheck now produces false positive info statements about potential modifications of the $output/$status/$lines variables, which is confusing and annoying.
Our current workaround is to put the following block at the beginning of every .bats file:
{
# Silence shellcheck for global bats variables.
# https://github.com/tiny-pilot/tinypilot/issues/1718
# shellcheck disable=SC2154
echo "${output}" "${status}" "${lines}" >/dev/null
}
This silences the SC2154 warnings that would otherwise appear.
Note that this workaround has to be wrapped in a custom “scope” (subshell), because of the shellcheck gotcha that directives immediately after the shebang apply to the entire file. The {...} ensures that the directive only ever applies to the echo statement, regardless of what else is between it and the shebang.
- Lingua principale
- Python
- Stelle
- 3.5k
- Fork
- 291
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tiny-pilot/tinypilot
-
bug medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
tiny-pilot/tinypilot#1419 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
tiny-pilot/tinypilot#1929 · 3 commenti ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
tiny-pilot/tinypilot#1899 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
tiny-pilot/tinypilot#1896 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
tiny-pilot/tinypilot#1882 ·
Tutte le issue di tiny-pilot/tinypilot
Issue simili
-
pydanty:is-working
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pydantic/pydantic-ai#8843 ·
I maintainer di solito rispondono entro 1 giorno
-
breaking change enhancement server
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
sktime/sktime#11310 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno