Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Use shellcheck for bats tests without workaround

Abierto
#1,718 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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

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

enhancement

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/$lines variables (see below)
  • Use the @test prefix notation instead of the #@test comment notation.
    • I.e., @test test_some_command() { instead of test_some_command() { #@test

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

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de tiny-pilot/tinypilot

Todos los issues de tiny-pilot/tinypilot

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.