fix(i18n): align schema and check tool lint

This commit is contained in:
whzy 2026-06-02 14:59:59 +08:00
parent 37dfd2e2e2
commit 39306994bc
2 changed files with 9 additions and 3 deletions

View File

@ -61,7 +61,7 @@ func checkLocaleFormat(fix bool) error {
continue continue
} }
if fix { if fix {
if err := os.WriteFile(path, formatted, 0644); err != nil { if err := os.WriteFile(path, formatted, 0600); err != nil {
return err return err
} }
continue continue
@ -128,13 +128,19 @@ func scanCodeKeys(roots []string) (map[string]struct{}, []string, error) {
} }
return nil return nil
} }
if entry.Type()&os.ModeSymlink != 0 {
return nil
}
if filepath.Ext(path) != ".go" { if filepath.Ext(path) != ".go" {
return nil return nil
} }
if strings.HasSuffix(path, "_test.go") { if strings.HasSuffix(path, "_test.go") {
return nil return nil
} }
data, err := os.ReadFile(path) if !entry.Type().IsRegular() {
return nil
}
data, err := os.ReadFile(path) // #nosec G122 -- dev-only scan over repo roots; symlinks are skipped above.
if err != nil { if err != nil {
return err return err
} }

View File

@ -7,6 +7,6 @@
"minLength": 1 "minLength": 1
}, },
"propertyNames": { "propertyNames": {
"pattern": "^(cmd|flag|error|output|prompt|table)\\.[a-z0-9_.-]+$" "pattern": "^(cmd|flag|error|output|prompt|success|warning|table)\\.[a-z0-9_.-]+$"
} }
} }