@sablier/devkit 1.9.0 → 1.9.1
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 +16 -3
- package/package.json +1 -1
package/just/csv.just
CHANGED
|
@@ -9,6 +9,7 @@ import "./settings.just"
|
|
|
9
9
|
_csv-check glob="data/*/*.{csv,tsv}" schema="" ignore="*.invalid *.valid *validation-errors.*":
|
|
10
10
|
import fnmatch
|
|
11
11
|
import glob as globmod
|
|
12
|
+
import re
|
|
12
13
|
import subprocess
|
|
13
14
|
import sys
|
|
14
15
|
|
|
@@ -22,14 +23,26 @@ _csv-check glob="data/*/*.{csv,tsv}" schema="" ignore="*.invalid *.valid *valida
|
|
|
22
23
|
schema = "{{ schema }}" or None
|
|
23
24
|
globs = "{{ glob }}"
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
# Infer extension label from glob pattern
|
|
27
|
+
ext_match = re.search(r'\.(\w+|\{[^}]+\})$', globs)
|
|
28
|
+
if ext_match:
|
|
29
|
+
ext = ext_match.group(1)
|
|
30
|
+
if ext.startswith('{') and ext.endswith('}'):
|
|
31
|
+
# Handle brace expansion like {csv,tsv}
|
|
32
|
+
ext_label = '.' + '/'.join(f'.{e}' for e in ext[1:-1].split(','))[1:]
|
|
33
|
+
else:
|
|
34
|
+
ext_label = f'.{ext}'
|
|
35
|
+
else:
|
|
36
|
+
ext_label = 'CSV/TSV'
|
|
37
|
+
|
|
38
|
+
print(f"Validating {ext_label} files...")
|
|
26
39
|
files = globmod.glob(globs)
|
|
27
40
|
|
|
28
41
|
# Filter ignored files
|
|
29
42
|
files = [f for f in files if not any(fnmatch.fnmatch(f, p) for p in ignore_patterns)]
|
|
30
43
|
|
|
31
44
|
if not files:
|
|
32
|
-
print(f"ℹ️ No
|
|
45
|
+
print(f"ℹ️ No {ext_label} files found to validate")
|
|
33
46
|
sys.exit(0)
|
|
34
47
|
|
|
35
48
|
for file in files:
|
|
@@ -42,7 +55,7 @@ _csv-check glob="data/*/*.{csv,tsv}" schema="" ignore="*.invalid *.valid *valida
|
|
|
42
55
|
subprocess.run(["just", "_csv-show-errors", file])
|
|
43
56
|
sys.exit(1)
|
|
44
57
|
|
|
45
|
-
print(f"✅ All
|
|
58
|
+
print(f"✅ All {ext_label} files are valid")
|
|
46
59
|
|
|
47
60
|
# Show validation errors for a CSV/TSV file
|
|
48
61
|
[group("checks"), script("python3")]
|
package/package.json
CHANGED