-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmptyLinter.affine
More file actions
38 lines (32 loc) · 798 Bytes
/
Copy pathEmptyLinter.affine
File metadata and controls
38 lines (32 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 hyperpolymath
module EmptyLinter;
use Deno::{readTextFile, writeTextFile};
use ByteDetector::{scan, apply_fixes};
use TextTransform::{get_metrics};
use PathHandler::{from_trusted, unwrap_path};
pub fn audit_file(path: String) {
let content = readTextFile(path);
scan(content)
}
pub fn fix_file(path: String) -> Int {
let content = readTextFile(path);
let (fixed, count) = apply_fixes(content);
if count > 0 {
writeTextFile(path, fixed);
count
} else {
0
}
}
pub fn get_file_metrics(path: String) {
let content = readTextFile(path);
get_metrics(content)
}
pub fn batch_audit(paths: [String]) {
let mut results = [];
for p in paths {
results = results ++ [audit_file(p)];
}
results
}