Use shellcheck for bats tests without workaround
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- リファクタリング
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- bash
- 領域
- testing-qa, tooling
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 3.5k
- フォーク
- 291
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
tiny-pilot/tinypilot のほかの issue
-
bug medium
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
tiny-pilot/tinypilot#1419 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
tiny-pilot/tinypilot#1929 · コメント 3 件 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
tiny-pilot/tinypilot#1899 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
tiny-pilot/tinypilot#1896 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
tiny-pilot/tinypilot#1882 ·
tiny-pilot/tinypilot の issue をすべて見る
似ている issue
-
agent-ready documentation needs-triage
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
instance instance add
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
searxng/searx-instances#939 · コメント 1 件 ·
-
area-deployment area-integrations triage:bot-seen
難易度 2/5 半日 初心者へのやさしさ 86/100