Implement the first part of RFC 20250303-linter-policy (#2577)

Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
This commit is contained in:
Christian Mesh
2025-03-10 13:16:27 -04:00
committed by GitHub
parent eab41a07c5
commit b2bf39802a
51 changed files with 34 additions and 255 deletions

View File

@@ -32,11 +32,11 @@ go 1.22`)
tempDir := t.TempDir()
dir := path.Join(tempDir, "testmethod-go")
if err := os.MkdirAll(dir, 0700); err != nil { //nolint:mnd // This check is stupid
if err := os.MkdirAll(dir, 0700); err != nil {
t.Errorf("Failed to create temporary directory (%v)", err)
}
if err := os.WriteFile(path.Join(dir, "go.mod"), goMod, 0600); err != nil { //nolint:mnd // This check is stupid
if err := os.WriteFile(path.Join(dir, "go.mod"), goMod, 0600); err != nil {
t.Errorf("%v", err)
}
if err := ejectFile("testmethod.go", path.Join(dir, "testmethod.go")); err != nil {
@@ -65,7 +65,7 @@ func Python(t *testing.T) []string {
tempDir := t.TempDir()
dir := path.Join(tempDir, "testmethod-py")
if err := os.MkdirAll(dir, 0700); err != nil { //nolint:mnd // This check is stupid
if err := os.MkdirAll(dir, 0700); err != nil {
t.Errorf("Failed to create temporary directory (%v)", err)
}
target := path.Join(dir, "testmethod.py")
@@ -81,7 +81,7 @@ func ejectFile(file string, target string) error {
if err != nil {
return fmt.Errorf("failed to read %s file from embedded dataset (%w)", file, err)
}
if err := os.WriteFile(target, contents, 0600); err != nil { //nolint:mnd // This check is stupid
if err := os.WriteFile(target, contents, 0600); err != nil {
return fmt.Errorf("failed to create %s file at %s (%w)", file, target, err)
}
return nil