Use shellcheck for bats tests without workaround
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Refactorización
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- bash
- Área
- testing-qa, tooling
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 3.5k
- Forks
- 291
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tiny-pilot/tinypilot
-
bug medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
tiny-pilot/tinypilot#1419 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
tiny-pilot/tinypilot#1929 · 3 comentarios ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
tiny-pilot/tinypilot#1899 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
tiny-pilot/tinypilot#1896 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
tiny-pilot/tinypilot#1882 ·
Todos los issues de tiny-pilot/tinypilot
Issues similares
-
agent-ready documentation needs-triage
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
-
Add https://search.jeremyh.xyz/ Abiertoinstance instance add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
searxng/searx-instances#939 · 1 comentario ·
-
area-deployment area-integrations triage:bot-seen
Dificultad 2/5 Medio día Aptitud para principiantes 86/100