mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-18 08:05:47 +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,7 +26,7 @@ function __err(msg) {
|
||||
}
|
||||
function __num(v, what) {
|
||||
var n = Number(v);
|
||||
if (typeof v === "boolean" || isNaN(n)) throw __err((what || "value") + " must be a number");
|
||||
if (typeof v === "boolean" || Number.isNaN(n)) throw __err((what || "value") + " must be a number");
|
||||
return n;
|
||||
}
|
||||
function __str(v) {
|
||||
@@ -43,11 +43,11 @@ if (typeof String.prototype.substr !== "function") {
|
||||
if (this === null || this === undefined) throw new TypeError("String.substr called on null or undefined");
|
||||
var text = String(this), n = text.length;
|
||||
var from = Number(start);
|
||||
if (isNaN(from)) from = 0;
|
||||
if (Number.isNaN(from)) from = 0;
|
||||
// ToIntegerOrInfinity, then clamp positive or negative offsets.
|
||||
from = from < 0 ? Math.max(n + Math.ceil(from), 0) : Math.min(Math.floor(from), n);
|
||||
var count = length === undefined ? n - from : Number(length);
|
||||
if (isNaN(count) || count <= 0) return "";
|
||||
if (Number.isNaN(count) || count <= 0) return "";
|
||||
return text.slice(from, from + count);
|
||||
},
|
||||
writable: true, configurable: true
|
||||
@@ -436,7 +436,7 @@ function __callable(o) {
|
||||
// 1-based collections with `[n]` access.
|
||||
var __coll = {
|
||||
get: function (t, k, r) {
|
||||
if (typeof k === "string" && /^[0-9]+$/.test(k)) return t.__at(parseInt(k, 10));
|
||||
if (typeof k === "string" && /^[0-9]+$/.test(k)) return t.__at(Number.parseInt(k, 10));
|
||||
return Reflect.get(t, k, r);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -750,7 +750,7 @@ function __uiMouseWanted(c, inherited) {
|
||||
function __uiMouseEvent(type, target, v) {
|
||||
var num = function (x, d) {
|
||||
x = Number(x);
|
||||
return isFinite(x) ? x : d;
|
||||
return Number.isFinite(x) ? x : d;
|
||||
};
|
||||
var keys = { alt: !!v.altKey, control: !!v.ctrlKey, ctrl: !!v.ctrlKey, meta: !!v.metaKey, shift: !!v.shiftKey };
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user