Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ci: re-enable revive and gosec linters#17225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 1 commit intomainfromcj/reenable-linters
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions.golangci.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,6 +164,7 @@ linters-settings:
- name: unnecessary-stmt
- name: unreachable-code
- name: unused-parameter
exclude: "**/*_test.go"
- name: unused-receiver
- name: var-declaration
- name: var-naming
Expand DownExpand Up@@ -195,8 +196,6 @@ issues:
- errcheck
- forcetypeassert
- exhaustruct # This is unhelpful in tests.
- revive # TODO(JonA): disabling in order to update golangci-lint
- gosec # TODO(JonA): disabling in order to update golangci-lint
- path: scripts/*
linters:
- exhaustruct
Expand Down
4 changes: 2 additions & 2 deletionscoderd/agentapi/logs_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -118,7 +118,7 @@ func TestBatchCreateLogs(t *testing.T) {
level = database.LogLevel(strings.ToLower(logEntry.Level.String()))
}
insertWorkspaceAgentLogsParams.Level[i] = level
insertWorkspaceAgentLogsParams.OutputLength += int32(len(logEntry.Output))
insertWorkspaceAgentLogsParams.OutputLength += int32(len(logEntry.Output)) // nolint:gosec

insertWorkspaceAgentLogsReturn[i] = database.WorkspaceAgentLog{
AgentID: agent.ID,
Expand DownExpand Up@@ -270,7 +270,7 @@ func TestBatchCreateLogs(t *testing.T) {
CreatedAt: now,
Output: []string{"hello world"},
Level: []database.LogLevel{database.LogLevelInfo},
OutputLength: int32(len(req.Logs[0].Output)),
OutputLength: int32(len(req.Logs[0].Output)), // nolint:gosec
}
dbInsertRes := []database.WorkspaceAgentLog{
{
Expand Down
2 changes: 1 addition & 1 deletioncoderd/idpsync/group_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -872,7 +872,7 @@ func (o orgSetupDefinition) Assert(t *testing.T, orgID uuid.UUID, db database.St
}
}

func (o orgGroupAssert) Assert(t *testing.T, orgID uuid.UUID, db database.Store, user database.User) {
func (o*orgGroupAssert) Assert(t *testing.T, orgID uuid.UUID, db database.Store, user database.User) {
t.Helper()

ctx := context.Background()
Expand Down
2 changes: 1 addition & 1 deletioncoderd/metricscache/metricscache_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -249,7 +249,7 @@ func TestCache_BuildTime(t *testing.T) {
})

dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{
BuildNumber: int32(1 + buildNumber),
BuildNumber: int32(1 + buildNumber), // nolint:gosec
WorkspaceID: workspace.ID,
InitiatorID: user.ID,
TemplateVersionID: templateVersion.ID,
Expand Down
4 changes: 2 additions & 2 deletionscoderd/notifications/reports/generator_internal_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -354,10 +354,10 @@ func TestReportFailedWorkspaceBuilds(t *testing.T) {
at := now.Add(-time.Duration(i) * time.Hour)

pj1 := dbgen.ProvisionerJob(t, db, ps, database.ProvisionerJob{OrganizationID: org.ID, Error: jobError, ErrorCode: jobErrorCode, CompletedAt: sql.NullTime{Time: at, Valid: true}})
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{WorkspaceID: w1.ID, BuildNumber: int32(i), TemplateVersionID: t1v1.ID, JobID: pj1.ID, CreatedAt: at, Transition: database.WorkspaceTransitionStart, Reason: database.BuildReasonInitiator})
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{WorkspaceID: w1.ID, BuildNumber: int32(i), TemplateVersionID: t1v1.ID, JobID: pj1.ID, CreatedAt: at, Transition: database.WorkspaceTransitionStart, Reason: database.BuildReasonInitiator}) // nolint:gosec

pj2 := dbgen.ProvisionerJob(t, db, ps, database.ProvisionerJob{OrganizationID: org.ID, Error: jobError, ErrorCode: jobErrorCode, CompletedAt: sql.NullTime{Time: at, Valid: true}})
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{WorkspaceID: w1.ID, BuildNumber: int32(i) + 100, TemplateVersionID: t1v2.ID, JobID: pj2.ID, CreatedAt: at, Transition: database.WorkspaceTransitionStart, Reason: database.BuildReasonInitiator})
_ = dbgen.WorkspaceBuild(t, db, database.WorkspaceBuild{WorkspaceID: w1.ID, BuildNumber: int32(i) + 100, TemplateVersionID: t1v2.ID, JobID: pj2.ID, CreatedAt: at, Transition: database.WorkspaceTransitionStart, Reason: database.BuildReasonInitiator}) // nolint:gosec
}

// When
Expand Down
4 changes: 2 additions & 2 deletionscoderd/util/xio/limitwriter_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -121,7 +121,7 @@ func TestLimitWriter(t *testing.T) {
n, err := cryptorand.Read(data)
require.NoError(t, err, "crand read")
require.Equal(t, wc.N, n, "correct bytes read")
max := data[:wc.ExpN]
maxSeen := data[:wc.ExpN]
n, err = w.Write(data)
if wc.Err {
require.Error(t, err, "exp error")
Expand All@@ -131,7 +131,7 @@ func TestLimitWriter(t *testing.T) {

// Need to use this to compare across multiple writes.
// Each write appends to the expected output.
allBuff.Write(max)
allBuff.Write(maxSeen)

require.Equal(t, wc.ExpN, n, "correct bytes written")
require.Equal(t, allBuff.Bytes(), buf.Bytes(), "expected data")
Expand Down
2 changes: 1 addition & 1 deletionenterprise/coderd/license/license_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -856,7 +856,7 @@ func TestLicenseEntitlements(t *testing.T) {
generatedLicenses := make([]database.License, 0, len(tc.Licenses))
for i, lo := range tc.Licenses {
generatedLicenses = append(generatedLicenses, database.License{
ID: int32(i),
ID: int32(i), // nolint:gosec
UploadedAt: time.Now().Add(time.Hour * -1),
JWT: lo.Generate(t),
Exp: lo.GraceAt,
Expand Down
8 changes: 4 additions & 4 deletionsenterprise/coderd/workspacequota_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,9 +73,9 @@ func TestWorkspaceQuota(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
max := 1
maxWorkspaces := 1
client, _, api, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
UserWorkspaceQuota:max,
UserWorkspaceQuota:maxWorkspaces,
LicenseOptions: &coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureTemplateRBAC: 1,
Expand DownExpand Up@@ -195,9 +195,9 @@ func TestWorkspaceQuota(t *testing.T) {

ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
defer cancel()
max := 1
maxWorkspaces := 1
client, _, api, user := coderdenttest.NewWithAPI(t, &coderdenttest.Options{
UserWorkspaceQuota:max,
UserWorkspaceQuota:maxWorkspaces,
LicenseOptions: &coderdenttest.LicenseOptions{
Features: license.Features{
codersdk.FeatureTemplateRBAC: 1,
Expand Down
8 changes: 4 additions & 4 deletionsmcp/mcp_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -306,11 +306,11 @@ func makeJSONRPCRequest(t *testing.T, method, name string, args map[string]any)
JSONRPC: "2.0",
Request: mcp.Request{Method: method},
Params: struct { // Unfortunately, there is no type for this yet.
Name string"json:\"name\""
Arguments map[string]any"json:\"arguments,omitempty\""
Name string`json:"name"`
Arguments map[string]any`json:"arguments,omitempty"`
Meta *struct {
ProgressToken mcp.ProgressToken"json:\"progressToken,omitempty\""
}"json:\"_meta,omitempty\""
ProgressToken mcp.ProgressToken`json:"progressToken,omitempty"`
}`json:"_meta,omitempty"`
}{
Name: name,
Arguments: args,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp