@sablier/devkit 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/just/csv.just +10 -10
- package/package.json +1 -1
- package/just/tsv.just +0 -15
package/just/csv.just
CHANGED
|
@@ -6,7 +6,7 @@ import "./settings.just"
|
|
|
6
6
|
|
|
7
7
|
# Check CSV/TSV files using qsv: https://github.com/dathere/qsv
|
|
8
8
|
[group("checks"), script("python3")]
|
|
9
|
-
_csv-check
|
|
9
|
+
_csv-check glob="data/*/*.{csv,tsv}" schema="" ignore="*.invalid *.valid *validation-errors.*":
|
|
10
10
|
import fnmatch
|
|
11
11
|
import glob as globmod
|
|
12
12
|
import subprocess
|
|
@@ -18,19 +18,18 @@ _csv-check globs="data/*/*.csv" ext="CSV" schema="" ignore="*.csv.invalid|*.csv.
|
|
|
18
18
|
print("Install it: https://github.com/dathere/qsv")
|
|
19
19
|
sys.exit(1)
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
ignore_patterns = "{{ ignore }}".split("|") if "{{ ignore }}" else []
|
|
21
|
+
ignore_patterns = "{{ ignore }}".split() if "{{ ignore }}" else []
|
|
23
22
|
schema = "{{ schema }}" or None
|
|
24
|
-
globs = "{{
|
|
23
|
+
globs = "{{ glob }}"
|
|
25
24
|
|
|
26
|
-
print(f"Validating
|
|
25
|
+
print(f"Validating CSV/TSV files...")
|
|
27
26
|
files = globmod.glob(globs)
|
|
28
27
|
|
|
29
28
|
# Filter ignored files
|
|
30
29
|
files = [f for f in files if not any(fnmatch.fnmatch(f, p) for p in ignore_patterns)]
|
|
31
30
|
|
|
32
31
|
if not files:
|
|
33
|
-
print(f"ℹ️ No
|
|
32
|
+
print(f"ℹ️ No CSV/TSV files found to validate")
|
|
34
33
|
sys.exit(0)
|
|
35
34
|
|
|
36
35
|
for file in files:
|
|
@@ -40,26 +39,27 @@ _csv-check globs="data/*/*.csv" ext="CSV" schema="" ignore="*.csv.invalid|*.csv.
|
|
|
40
39
|
result = subprocess.run(cmd, capture_output=True)
|
|
41
40
|
if result.returncode != 0:
|
|
42
41
|
print(f"❌ Validation failed for: {file}")
|
|
43
|
-
subprocess.run(["just", "_csv-show-errors", file
|
|
42
|
+
subprocess.run(["just", "_csv-show-errors", file])
|
|
44
43
|
sys.exit(1)
|
|
45
44
|
|
|
46
|
-
print(f"✅ All
|
|
45
|
+
print(f"✅ All CSV/TSV files are valid")
|
|
47
46
|
|
|
48
47
|
# Show validation errors for a CSV/TSV file
|
|
49
48
|
[group("checks"), script("python3")]
|
|
50
|
-
_csv-show-errors file
|
|
49
|
+
_csv-show-errors file:
|
|
51
50
|
import os
|
|
52
51
|
import subprocess
|
|
53
52
|
import sys
|
|
54
53
|
|
|
55
54
|
file = "{{ file }}"
|
|
55
|
+
# qsv always produces .validation-errors.tsv regardless of input format
|
|
56
56
|
error_file = f"{file}.validation-errors.tsv"
|
|
57
57
|
|
|
58
58
|
if not os.path.exists(error_file):
|
|
59
59
|
print(f"Error file not found: {error_file}")
|
|
60
60
|
sys.exit(0)
|
|
61
61
|
|
|
62
|
-
# Count errors (qsv auto-detects
|
|
62
|
+
# Count errors (qsv auto-detects delimiter based on file extension)
|
|
63
63
|
result = subprocess.run(["qsv", "count", error_file], capture_output=True, text=True)
|
|
64
64
|
try:
|
|
65
65
|
total = int(result.stdout.strip()) if result.returncode == 0 and result.stdout.strip() else 0
|
package/package.json
CHANGED
package/just/tsv.just
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import "./csv.just"
|
|
2
|
-
|
|
3
|
-
# ---------------------------------------------------------------------------- #
|
|
4
|
-
# TSV WRAPPERS #
|
|
5
|
-
# ---------------------------------------------------------------------------- #
|
|
6
|
-
|
|
7
|
-
# Check TSV files using qsv: https://github.com/dathere/qsv
|
|
8
|
-
[group("checks")]
|
|
9
|
-
_tsv-check globs="data/*/*.tsv" ext="TSV" schema="" ignore="*.tsv.invalid|*.tsv.valid|*validation-errors.tsv":
|
|
10
|
-
@just _csv-check "{{ globs }}" "{{ ext }}" "{{ schema }}" "{{ ignore }}"
|
|
11
|
-
|
|
12
|
-
# Show validation errors for a TSV file
|
|
13
|
-
[group("checks")]
|
|
14
|
-
_tsv-show-errors file:
|
|
15
|
-
@just _csv-show-errors "{{ file }}" "TSV"
|