Skip to content

Commit 51ef4bc

Browse files
committed
feat: v0.2.0
1 parent 2ee4944 commit 51ef4bc

File tree

6 files changed

+34
-15
lines changed

6 files changed

+34
-15
lines changed

.golangci.next.reference.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3536,28 +3536,31 @@ linters-settings:
35363536
constant-kind: true
35373537

35383538
usetesting:
3539-
# Enable/disable `context.Background()` detections.
3540-
# Disabled if Go < 1.24.
3539+
# Enable/disable `os.CreateTemp("", ...)` detections.
35413540
# Default: true
3542-
context-background: false
3541+
os-create-temp: false
35433542

3544-
# Enable/disable `context.TODO()` detections.
3545-
# Disabled if Go < 1.24.
3543+
# Enable/disable `os.MkdirTemp()` detections.
35463544
# Default: true
3547-
context-todo: false
3545+
os-mkdir-temp: false
3546+
3547+
# Enable/disable `os.Setenv()` detections.
3548+
# Default: false
3549+
os-setenv: true
3550+
3551+
# Enable/disable `os.TempDir()` detections.
3552+
# Default: false
3553+
os-temp-dir: true
35483554

35493555
# Enable/disable `os.Chdir()` detections.
35503556
# Disabled if Go < 1.24.
35513557
# Default: true
35523558
os-chdir: false
35533559

3554-
# Enable/disable `os.MkdirTemp()` detections.
3560+
# Enable/disable `context.Background()` detections.
3561+
# Disabled if Go < 1.24.
35553562
# Default: true
3556-
os-mkdir-temp: false
3557-
3558-
# Enable/disable `os.Setenv()` detections.
3559-
# Default: false
3560-
os-setenv: true
3563+
context-background: false
35613564

35623565
unconvert:
35633566
# Remove conversions that force intermediate rounding.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ require (
6868
github.com/lasiar/canonicalheader v1.1.2
6969
github.com/ldez/gomoddirectives v0.2.4
7070
github.com/ldez/tagliatelle v0.6.0
71-
github.com/ldez/usetesting v0.1.0
71+
github.com/ldez/usetesting v0.2.0
7272
github.com/leonklingele/grouper v1.1.2
7373
github.com/macabu/inamedparam v0.1.3
7474
github.com/maratori/testableexamples v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@
428428
"unparam",
429429
"unused",
430430
"usestdlibvars",
431+
"usetesting",
431432
"varnamelen",
432433
"wastedassign",
433434
"whitespace",
@@ -3348,6 +3349,14 @@
33483349
"os-setenv": {
33493350
"type": "boolean",
33503351
"default": false
3352+
},
3353+
"os-create-temp": {
3354+
"type": "boolean",
3355+
"default": true
3356+
},
3357+
"os-temp-dir": {
3358+
"type": "boolean",
3359+
"default": false
33513360
}
33523361
}
33533362
},

pkg/config/linters_settings.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ var defaultLintersSettings = LintersSettings{
184184
ContextTodo: true,
185185
OSChdir: true,
186186
OSMkdirTemp: true,
187+
OSSetenv: false,
188+
OSTempDir: false,
189+
OSSCreateTemp: true,
187190
},
188191
Varnamelen: VarnamelenSettings{
189192
MaxDistance: 5,
@@ -972,6 +975,8 @@ type UseTestingSettings struct {
972975
OSChdir bool `mapstructure:"os-chdir"`
973976
OSMkdirTemp bool `mapstructure:"os-mkdir-temp"`
974977
OSSetenv bool `mapstructure:"os-setenv"`
978+
OSTempDir bool `mapstructure:"os-temp-dir"`
979+
OSSCreateTemp bool `mapstructure:"os-create-temp"`
975980
}
976981

977982
type UnconvertSettings struct {

pkg/golinters/usetesting/usetesting.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ func New(settings *config.UseTestingSettings) *goanalysis.Linter {
1919
"oschdir": settings.OSChdir,
2020
"osmkdirtemp": settings.OSMkdirTemp,
2121
"ossetenv": settings.OSSetenv,
22+
"ostempdir": settings.OSTempDir,
23+
"oscreatetemp": settings.OSSCreateTemp,
2224
}
2325
}
2426

0 commit comments

Comments
 (0)