prettier and eslint ignore valid syntax for qml specific syntax. Clippy lint resolved in .rs. unused py files commented to be ignored by ruff

This commit is contained in:
2026-05-19 23:53:09 +02:00
parent ceca949535
commit dd49198cf7
10 changed files with 240 additions and 224 deletions
+18 -18
View File
@@ -1,26 +1,26 @@
name: Format (JS/TS)
on:
pull_request:
pull_request:
jobs:
format:
runs-on: alpine
container: node:20-alpine
format:
runs-on: alpine
container: node:20-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: |
apk add --no-cache \
git
- name: Install tools
run: |
apk add --no-cache \
git
- name: Prettier
run: |
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore
else
echo "No JS/TS files found"
fi
- name: Prettier
run: |
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
npx --yes prettier --check "**/*.{js,jsx,ts,tsx,mjs,cjs}" --ignore-path .gitignore
else
echo "No JS/TS files found"
fi
+25 -25
View File
@@ -1,33 +1,33 @@
name: Lint (JS/TS)
on:
pull_request:
pull_request:
jobs:
lint:
runs-on: alpine
container: node:20-alpine
lint:
runs-on: alpine
container: node:20-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: |
apk add --no-cache \
git
- name: Install tools
run: |
apk add --no-cache \
git
- name: ESLint
run: |
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
if [ -f package.json ]; then
npm install --no-audit --no-fund
fi
if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then
npx --yes eslint .
else
echo "No eslint config found"
fi
else
echo "No JS/TS files found"
fi
- name: ESLint
run: |
if [ -n "$(find . \( -iname "*.js" -o -iname "*.jsx" -o -iname "*.ts" -o -iname "*.tsx" -o -iname "*.mjs" -o -iname "*.cjs" \) -print -quit)" ]; then
if [ -f package.json ]; then
npm install --no-audit --no-fund
fi
if [ -f eslint.config.js ] || [ -f eslint.config.mjs ] || [ -f eslint.config.cjs ] || [ -f .eslintrc ] || [ -f .eslintrc.js ] || [ -f .eslintrc.cjs ] || [ -f .eslintrc.json ] || [ -f .eslintrc.yaml ] || [ -f .eslintrc.yml ]; then
npx --yes eslint .
else
echo "No eslint config found"
fi
else
echo "No JS/TS files found"
fi
+19 -19
View File
@@ -1,27 +1,27 @@
name: Lint (Python)
on:
pull_request:
pull_request:
jobs:
lint:
runs-on: alpine
container: node:20-alpine
lint:
runs-on: alpine
container: node:20-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: |
apk add --no-cache \
git \
python3 \
py3-pip
- name: Install tools
run: |
apk add --no-cache \
git \
python3 \
py3-pip
- name: Ruff
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install --no-cache-dir ruff
ruff check .
- name: Ruff
run: |
python3 -m venv .venv
. .venv/bin/activate
pip install --no-cache-dir ruff
ruff check .
+26 -26
View File
@@ -1,34 +1,34 @@
name: Lint (Rust)
on:
pull_request:
pull_request:
jobs:
lint:
runs-on: alpine
container: node:20-alpine
lint:
runs-on: alpine
container: node:20-alpine
steps:
- name: Checkout
uses: actions/checkout@v4
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install tools
run: |
apk add --no-cache \
git \
cargo \
rust \
rust-clippy
- name: Install tools
run: |
apk add --no-cache \
git \
cargo \
rust \
rust-clippy
- name: Clippy
run: |
if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then
find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do
cargo clippy --manifest-path "$manifest" -- -D warnings
done
elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then
echo "Rust files found but no Cargo.toml"
exit 1
else
echo "No Rust project found"
fi
- name: Clippy
run: |
if [ -n "$(find . -name "Cargo.toml" -print -quit)" ]; then
find . -name "Cargo.toml" -print0 | while IFS= read -r -d '' manifest; do
cargo clippy --manifest-path "$manifest" -- -D warnings
done
elif [ -n "$(find . -name "*.rs" -print -quit)" ]; then
echo "Rust files found but no Cargo.toml"
exit 1
else
echo "No Rust project found"
fi
+2
View File
@@ -0,0 +1,2 @@
scripts/fzf.js
scripts/fuzzysort.js
+12 -10
View File
@@ -1,11 +1,13 @@
import json
import typer
from zshell.assets.schemes.catppuccin import catppuccin
# import json
# import typer
# from zshell.assets.schemes.catppuccin import catppuccin
#
# app = typer.Typer()
#
# SCHEMES = catppuccin.variants.flavors
#
#
# @app.command()
# def set():
app = typer.Typer()
SCHEMES = catppuccin.variants.flavors
@app.command()
def set():
# TODO: Currently unsused
+15 -13
View File
@@ -1,14 +1,16 @@
import typer
import subprocess
# import typer
# import subprocess
#
# from typing import Optional
#
# app = typer.Typer()
#
# RECORDER = "gpu-screen-recorder"
# HOME = str(os.getenv("HOME"))
# CONFIG = Path(HOME + "/.config/zshell/config.json")
#
#
# @app.command()
# def start():
from typing import Optional
app = typer.Typer()
RECORDER = "gpu-screen-recorder"
HOME = str(os.getenv("HOME"))
CONFIG = Path(HOME + "/.config/zshell/config.json")
@app.command()
def start():
# TODO: Currently unused
+12 -10
View File
@@ -1,14 +1,16 @@
export default [
{
files: ["**/*.{js,jsx,ts,tsx,mjs,cjs}"],
languageOptions: {
ecmaVersion: 2021,
sourceType: "module"
{
ignores: ["scripts/fzf.js", "scripts/fuzzysort.js"],
},
linterOptions: {
reportUnusedDisableDirectives: true
{
files: ["**/*.{js,jsx,ts,tsx,mjs,cjs}"],
languageOptions: {
ecmaVersion: 2021,
sourceType: "module",
},
linterOptions: {
reportUnusedDisableDirectives: true,
},
rules: {},
},
rules: {
}
}
];
+95 -95
View File
@@ -3,141 +3,141 @@
// Translated to Js from Cython with an LLM and reviewed
function min3(a, b, c) {
return a < b && a < c ? a : b < c ? b : c;
return a < b && a < c ? a : b < c ? b : c;
}
function max3(a, b, c) {
return a > b && a > c ? a : b > c ? b : c;
return a > b && a > c ? a : b > c ? b : c;
}
function min2(a, b) {
return a < b ? a : b;
return a < b ? a : b;
}
function max2(a, b) {
return a > b ? a : b;
return a > b ? a : b;
}
function levenshteinDistance(s1, s2) {
let len1 = s1.length;
let len2 = s2.length;
let len1 = s1.length;
let len2 = s2.length;
if (len1 === 0) return len2;
if (len2 === 0) return len1;
if (len1 === 0) return len2;
if (len2 === 0) return len1;
if (len2 > len1) {
[s1, s2] = [s2, s1];
[len1, len2] = [len2, len1];
}
let prev = new Array(len2 + 1);
let curr = new Array(len2 + 1);
for (let j = 0; j <= len2; j++) {
prev[j] = j;
}
for (let i = 1; i <= len1; i++) {
curr[0] = i;
for (let j = 1; j <= len2; j++) {
let cost = s1[i - 1] === s2[j - 1] ? 0 : 1;
curr[j] = min3(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost);
if (len2 > len1) {
[s1, s2] = [s2, s1];
[len1, len2] = [len2, len1];
}
[prev, curr] = [curr, prev];
}
return prev[len2];
let prev = new Array(len2 + 1);
let curr = new Array(len2 + 1);
for (let j = 0; j <= len2; j++) {
prev[j] = j;
}
for (let i = 1; i <= len1; i++) {
curr[0] = i;
for (let j = 1; j <= len2; j++) {
let cost = s1[i - 1] === s2[j - 1] ? 0 : 1;
curr[j] = min3(prev[j] + 1, curr[j - 1] + 1, prev[j - 1] + cost);
}
[prev, curr] = [curr, prev];
}
return prev[len2];
}
function partialRatio(shortS, longS) {
let lenS = shortS.length;
let lenL = longS.length;
let best = 0.0;
let lenS = shortS.length;
let lenL = longS.length;
let best = 0.0;
if (lenS === 0) return 1.0;
if (lenS === 0) return 1.0;
for (let i = 0; i <= lenL - lenS; i++) {
let sub = longS.slice(i, i + lenS);
let dist = levenshteinDistance(shortS, sub);
let score = 1.0 - dist / lenS;
if (score > best) best = score;
}
for (let i = 0; i <= lenL - lenS; i++) {
let sub = longS.slice(i, i + lenS);
let dist = levenshteinDistance(shortS, sub);
let score = 1.0 - dist / lenS;
if (score > best) best = score;
}
return best;
return best;
}
function computeScore(s1, s2) {
if (s1 === s2) return 1.0;
if (s1 === s2) return 1.0;
let dist = levenshteinDistance(s1, s2);
let maxLen = max2(s1.length, s2.length);
if (maxLen === 0) return 1.0;
let dist = levenshteinDistance(s1, s2);
let maxLen = max2(s1.length, s2.length);
if (maxLen === 0) return 1.0;
let full = 1.0 - dist / maxLen;
let part =
s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1);
let full = 1.0 - dist / maxLen;
let part =
s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1);
let score = 0.85 * full + 0.15 * part;
let score = 0.85 * full + 0.15 * part;
if (s1 && s2 && s1[0] !== s2[0]) {
score -= 0.05;
}
let lenDiff = Math.abs(s1.length - s2.length);
if (lenDiff >= 3) {
score -= (0.05 * lenDiff) / maxLen;
}
let commonPrefixLen = 0;
let minLen = min2(s1.length, s2.length);
for (let i = 0; i < minLen; i++) {
if (s1[i] === s2[i]) {
commonPrefixLen++;
} else {
break;
if (s1 && s2 && s1[0] !== s2[0]) {
score -= 0.05;
}
}
score += 0.02 * commonPrefixLen;
if (s1.includes(s2) || s2.includes(s1)) {
score += 0.06;
}
let lenDiff = Math.abs(s1.length - s2.length);
if (lenDiff >= 3) {
score -= (0.05 * lenDiff) / maxLen;
}
return Math.max(0.0, Math.min(1.0, score));
let commonPrefixLen = 0;
let minLen = min2(s1.length, s2.length);
for (let i = 0; i < minLen; i++) {
if (s1[i] === s2[i]) {
commonPrefixLen++;
} else {
break;
}
}
score += 0.02 * commonPrefixLen;
if (s1.includes(s2) || s2.includes(s1)) {
score += 0.06;
}
return Math.max(0.0, Math.min(1.0, score));
}
function computeTextMatchScore(s1, s2) {
if (s1 === s2) return 1.0;
if (s1 === s2) return 1.0;
let dist = levenshteinDistance(s1, s2);
let maxLen = max2(s1.length, s2.length);
if (maxLen === 0) return 1.0;
let dist = levenshteinDistance(s1, s2);
let maxLen = max2(s1.length, s2.length);
if (maxLen === 0) return 1.0;
let full = 1.0 - dist / maxLen;
let part =
s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1);
let full = 1.0 - dist / maxLen;
let part =
s1.length < s2.length ? partialRatio(s1, s2) : partialRatio(s2, s1);
let score = 0.4 * full + 0.6 * part;
let score = 0.4 * full + 0.6 * part;
let lenDiff = Math.abs(s1.length - s2.length);
if (lenDiff >= 10) {
score -= (0.02 * lenDiff) / maxLen;
}
let commonPrefixLen = 0;
let minLen = min2(s1.length, s2.length);
for (let i = 0; i < minLen; i++) {
if (s1[i] === s2[i]) {
commonPrefixLen++;
} else {
break;
let lenDiff = Math.abs(s1.length - s2.length);
if (lenDiff >= 10) {
score -= (0.02 * lenDiff) / maxLen;
}
}
score += 0.01 * commonPrefixLen;
if (s1.includes(s2) || s2.includes(s1)) {
score += 0.2;
}
let commonPrefixLen = 0;
let minLen = min2(s1.length, s2.length);
for (let i = 0; i < minLen; i++) {
if (s1[i] === s2[i]) {
commonPrefixLen++;
} else {
break;
}
}
score += 0.01 * commonPrefixLen;
return Math.max(0.0, Math.min(1.0, score));
if (s1.includes(s2) || s2.includes(s1)) {
score += 0.2;
}
return Math.max(0.0, Math.min(1.0, score));
}
+16 -8
View File
@@ -39,8 +39,10 @@ pub fn apply_rounded_corners(img: RgbaImage, radius: f32) -> RgbaImage {
);
let mut pixmap = rgba_image_to_pixmap(&img);
let mut dst_paint = PixmapPaint::default();
dst_paint.blend_mode = BlendMode::DestinationIn;
let dst_paint = PixmapPaint {
blend_mode: BlendMode::DestinationIn,
..Default::default()
};
pixmap.draw_pixmap(0, 0, mask.as_ref(), &dst_paint, Transform::identity(), None);
pixmap_to_rgba_image(pixmap)
}
@@ -69,8 +71,10 @@ pub fn apply_drop_shadow(
let shadow_x = (extra_left as f32 + offset_x) as i32;
let shadow_y = (extra_top as f32 + offset_y) as i32;
let mut sp = PixmapPaint::default();
sp.blend_mode = BlendMode::Source;
let sp = PixmapPaint {
blend_mode: BlendMode::Source,
..Default::default()
};
shadow_pixmap.draw_pixmap(
shadow_x,
shadow_y,
@@ -87,8 +91,10 @@ pub fn apply_drop_shadow(
let blurred_pixmap = rgba_image_to_pixmap(&blurred);
let mut canvas = Pixmap::new(canvas_w, canvas_h).expect("canvas pixmap");
let mut p = PixmapPaint::default();
p.blend_mode = BlendMode::Source;
let p = PixmapPaint {
blend_mode: BlendMode::Source,
..Default::default()
};
canvas.draw_pixmap(
0,
0,
@@ -98,8 +104,10 @@ pub fn apply_drop_shadow(
None,
);
let mut p2 = PixmapPaint::default();
p2.blend_mode = BlendMode::SourceOver;
let p2 = PixmapPaint {
blend_mode: BlendMode::SourceOver,
..Default::default()
};
canvas.draw_pixmap(
extra_left as i32,
extra_top as i32,