mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-11 21:02:20 +00:00
Sonar: [[ in the plugin-catalog check, Number.* in the boa runtimes, no Invoke-Expression (S7688, S7773, S8659) (#3427)
Clears all 29 open SonarCloud issues. - `examples/plugin-catalog/scripts/validate.sh`: `[[ ]]` in place of `[ ]` for bash tests (SonarCloud shell:S7688). Every script has a bash shebang; no test uses `-a`/`-o`, escaped parentheses or an unquoted pattern on the right of `=`. - `crates/expr/src/prelude.js`, `crates/script/src/prelude.js`, `crates/script/src/scriptui.js`: `Number.isFinite` / `Number.isNaN` / `Number.parseInt` (javascript:S7773). Every call already has a number (a `typeof` check or `Number()` before it), and `Number.parseInt === parseInt`, so nothing changes in boa. - `packaging/windows/test-legacy-fixture.ps1`: dot-sources `[scriptblock]::Create($block)` in place of `Invoke-Expression $block` (powershelldre:S8659). It runs in the same scope, so `$LegacyWxs` is still set after it. - `sonar-project.properties`: S7773 and S8786 are not raised on `*.jsx`. Those are After Effects ExtendScript (ES3), which also runs in After Effects and has no `Number.isFinite` or `String.prototype.trim`. The ignore covers 7 issues in `Ease Presets.jsx` and `Rename Layers.jsx`.
This commit is contained in:
1 parent
27fa43fd52
commit
c30fb9aeed
6 files changed
+24
-17
No files matched your search
@@ -26,12 +26,12 @@ file_url() {
|
||||
}
|
||||
|
||||
echo "== 1. schema"
|
||||
[ "$(wc -c <"$catalog")" -le $((4 << 20)) ] || fail "the catalog is larger than 4 MB (the app's limit)"
|
||||
[[ "$(wc -c <"$catalog")" -le $((4 << 20)) ]] || fail "the catalog is larger than 4 MB (the app's limit)"
|
||||
# Exactly one object of format 1 with a packages array (an empty file or a second value fails too),
|
||||
# checked even when the schema step is skipped.
|
||||
jq -e -s 'length == 1 and (.[0] | type == "object" and .schema == 1 and (.packages | type == "array"))' "$catalog" >/dev/null \
|
||||
|| fail "$catalog isn't one JSON object with \"schema\": 1 and a \"packages\" array"
|
||||
if [ "${SKIP_SCHEMA:-}" = 1 ]; then
|
||||
if [[ "${SKIP_SCHEMA:-}" = 1 ]]; then
|
||||
echo "skipped (SKIP_SCHEMA=1)"
|
||||
else
|
||||
npx --yes ajv-cli@5.0.0 validate --spec=draft2020 --strict=false -s "$here/schema.json" -d "$catalog"
|
||||
@@ -39,7 +39,7 @@ fi
|
||||
|
||||
echo "== 2. unique ids"
|
||||
dups=$(jq -r '.packages[].id' "$catalog" | sort | uniq -d)
|
||||
[ -z "$dups" ] || fail "duplicate package ids: $dups"
|
||||
[[ -z "$dups" ]] || fail "duplicate package ids: $dups"
|
||||
echo "ok"
|
||||
|
||||
echo "== 3. downloads"
|
||||
@@ -51,15 +51,15 @@ while IFS=$'\t' read -r p r id version url sha size; do
|
||||
curl -fsSL --retry 2 --max-filesize $((64 << 20)) -o "$file" "$url" || fail "$id $version: download failed"
|
||||
got_size=$(wc -c <"$file" | tr -d ' ')
|
||||
got_sha=$(sha256sum "$file" | cut -d' ' -f1)
|
||||
[ -z "$size" ] || [ "$size" = "$got_size" ] || fail "$id $version: size is $got_size, the catalog says $size"
|
||||
[ "$got_sha" = "$(tr 'A-F' 'a-f' <<<"$sha")" ] || fail "$id $version: SHA-256 is $got_sha, the catalog says $sha"
|
||||
[[ -z "$size" ]] || [[ "$size" = "$got_size" ]] || fail "$id $version: size is $got_size, the catalog says $size"
|
||||
[[ "$got_sha" = "$(tr 'A-F' 'a-f' <<<"$sha")" ]] || fail "$id $version: SHA-256 is $got_sha, the catalog says $sha"
|
||||
local_catalog=$(jq --argjson p "$p" --argjson r "$r" --arg u "$(file_url "$file")" '.packages[$p].versions[$r].url = $u' <<<"$local_catalog")
|
||||
done < <(jq -r '.packages | to_entries[] | .key as $p | .value as $pkg | $pkg.versions | to_entries[]
|
||||
| [$p, .key, $pkg.id, .value.version, .value.url, .value.sha256, (.value.size // "")] | @tsv' "$catalog")
|
||||
echo "ok"
|
||||
|
||||
echo "== 4. load with EffectCraft"
|
||||
if [ -z "${EFFECTCRAFT_CLI:-}" ]; then
|
||||
if [[ -z "${EFFECTCRAFT_CLI:-}" ]]; then
|
||||
echo "skipped (set EFFECTCRAFT_CLI to an effectcraft-cli build)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user