@sablier/devkit 1.8.0 → 1.8.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 +5 -4
- package/package.json +1 -1
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 globs="data/*/*.csv" ext="
|
|
9
|
+
_csv-check globs="data/*/*.csv" ext="csv" schema="" ignore="*.csv.invalid|*.csv.valid|*validation-errors.csv":
|
|
10
10
|
import fnmatch
|
|
11
11
|
import glob as globmod
|
|
12
12
|
import subprocess
|
|
@@ -18,7 +18,7 @@ _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
|
-
ext = "{{ ext }}" or "
|
|
21
|
+
ext = "{{ ext }}" or "csv"
|
|
22
22
|
ignore_patterns = "{{ ignore }}".split("|") if "{{ ignore }}" else []
|
|
23
23
|
schema = "{{ schema }}" or None
|
|
24
24
|
globs = "{{ globs }}"
|
|
@@ -47,19 +47,20 @@ _csv-check globs="data/*/*.csv" ext="CSV" schema="" ignore="*.csv.invalid|*.csv.
|
|
|
47
47
|
|
|
48
48
|
# Show validation errors for a CSV/TSV file
|
|
49
49
|
[group("checks"), script("python3")]
|
|
50
|
-
_csv-show-errors file ext="
|
|
50
|
+
_csv-show-errors file ext="csv":
|
|
51
51
|
import os
|
|
52
52
|
import subprocess
|
|
53
53
|
import sys
|
|
54
54
|
|
|
55
55
|
file = "{{ file }}"
|
|
56
|
+
# qsv always produces .validation-errors.tsv regardless of input format
|
|
56
57
|
error_file = f"{file}.validation-errors.tsv"
|
|
57
58
|
|
|
58
59
|
if not os.path.exists(error_file):
|
|
59
60
|
print(f"Error file not found: {error_file}")
|
|
60
61
|
sys.exit(0)
|
|
61
62
|
|
|
62
|
-
# Count errors (qsv auto-detects
|
|
63
|
+
# Count errors (qsv auto-detects delimiter based on file extension)
|
|
63
64
|
result = subprocess.run(["qsv", "count", error_file], capture_output=True, text=True)
|
|
64
65
|
try:
|
|
65
66
|
total = int(result.stdout.strip()) if result.returncode == 0 and result.stdout.strip() else 0
|
package/package.json
CHANGED