Skip to content

Commit c35aafe

Browse files
committed
Address any new linting issues
Signed-off-by: Timo Sand <[email protected]>
1 parent f167cca commit c35aafe

6 files changed

Lines changed: 65 additions & 46 deletions

github/resource_github_actions_organization_secret.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ func resourceGithubActionsOrganizationSecret() *schema.Resource {
8686
Computed: true,
8787
Description: "Date of secret update at the remote.",
8888
},
89+
// lintignore:XS001 // This is deprecated and will be removed in a future version.
8990
"destroy_on_drift": {
9091
Type: schema.TypeBool,
9192
Optional: true,

github/resource_github_actions_secret.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ func resourceGithubActionsSecret() *schema.Resource {
8585
Computed: true,
8686
Description: "Date of secret update at the remote.",
8787
},
88+
// lintignore:XS001 // This is deprecated and will be removed in a future version.
8889
"destroy_on_drift": {
8990
Type: schema.TypeBool,
9091
Optional: true,

github/resource_github_emu_group_mapping_migration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ func resourceGithubEMUGroupMappingV0() *schema.Resource {
2222
Required: true,
2323
Description: "Integer corresponding to the external group ID to be linked.",
2424
},
25+
// lintignore:XS001 // No changes to old schema versions
2526
"etag": {
2627
Type: schema.TypeString,
2728
Computed: true,

github/resource_github_repository.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ func resourceGithubRepository() *schema.Resource {
403403
Computed: true,
404404
Description: "Set to 'true' to enable security alerts for vulnerable dependencies. Enabling requires alerts to be enabled on the owner level. (Note for importing: GitHub enables the alerts on all repos by default). Note that vulnerability alerts have not been successfully tested on any GitHub Enterprise instance and may be unavailable in those settings.",
405405
},
406+
// lintignore:XS001 // This is deprecated and will be removed in a future version.
406407
"ignore_vulnerability_alerts_during_read": {
407408
Type: schema.TypeBool,
408409
Optional: true,
@@ -635,7 +636,8 @@ func resourceGithubRepositoryObject(d *schema.ResourceData) *github.Repository {
635636

636637
// only configure allow forking if repository is not public
637638
if visibility != "public" && (d.IsNewResource() || d.HasChange("allow_forking")) {
638-
if allowForking, ok := d.GetOkExists("allow_forking"); ok { //nolint:staticcheck,SA1019 // We sometimes need to use GetOkExists for booleans
639+
// lintignore:XR001
640+
if allowForking, ok := d.GetOkExists("allow_forking"); ok { //nolint:staticcheck //SA1019 // We sometimes need to use GetOkExists for booleans
639641
if val, ok := allowForking.(bool); ok {
640642
repository.AllowForking = github.Ptr(val)
641643
}
@@ -1005,6 +1007,7 @@ func resourceGithubRepositoryUpdate(ctx context.Context, d *schema.ResourceData,
10051007
}
10061008

10071009
if d.IsNewResource() || d.HasChange("vulnerability_alerts") {
1010+
// lintignore:XR001
10081011
if v, ok := d.GetOkExists("vulnerability_alerts"); ok { //nolint:staticcheck,SA1019 // We sometimes need to use GetOkExists for booleans
10091012
if val, ok := v.(bool); ok {
10101013
err := updateVulnerabilityAlerts(ctx, client, owner, repoName, val)

github/resource_github_repository_file_migration.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,69 +11,83 @@ import (
1111
func resourceGithubRepositoryFileV0() *schema.Resource {
1212
return &schema.Resource{
1313
Schema: map[string]*schema.Schema{
14+
// lintignore:XS001 // No changes to old schema versions
1415
"repository": {
1516
Type: schema.TypeString,
1617
Required: true,
1718
ForceNew: true,
1819
},
20+
// lintignore:XS001 // No changes to old schema versions
1921
"file": {
2022
Type: schema.TypeString,
2123
Required: true,
2224
ForceNew: true,
2325
},
26+
// lintignore:XS001 // No changes to old schema versions
2427
"content": {
2528
Type: schema.TypeString,
2629
Required: true,
2730
},
31+
// lintignore:XS001 // No changes to old schema versions
2832
"branch": {
2933
Type: schema.TypeString,
3034
Optional: true,
3135
ForceNew: true,
3236
},
37+
// lintignore:XS001,S020 // No changes to old schema versions
3338
"ref": {
3439
Type: schema.TypeString,
3540
Computed: true,
3641
ForceNew: true,
3742
},
43+
// lintignore:XS001 // No changes to old schema versions
3844
"commit_sha": {
3945
Type: schema.TypeString,
4046
Computed: true,
4147
},
48+
// lintignore:XS001 // No changes to old schema versions
4249
"commit_message": {
4350
Type: schema.TypeString,
4451
Optional: true,
4552
Computed: true,
4653
},
54+
// lintignore:XS001 // No changes to old schema versions
4755
"commit_author": {
4856
Type: schema.TypeString,
4957
Optional: true,
5058
RequiredWith: []string{"commit_email"},
5159
},
60+
// lintignore:XS001 // No changes to old schema versions
5261
"commit_email": {
5362
Type: schema.TypeString,
5463
Optional: true,
5564
RequiredWith: []string{"commit_author"},
5665
},
66+
// lintignore:XS001 // No changes to old schema versions
5767
"sha": {
5868
Type: schema.TypeString,
5969
Computed: true,
6070
},
71+
// lintignore:XS001 // No changes to old schema versions
6172
"overwrite_on_create": {
6273
Type: schema.TypeBool,
6374
Optional: true,
6475
Default: false,
6576
},
77+
// lintignore:XS001 // No changes to old schema versions
6678
"autocreate_branch": {
6779
Type: schema.TypeBool,
6880
Optional: true,
6981
Default: false,
7082
},
83+
// lintignore:XS001 // No changes to old schema versions
7184
"autocreate_branch_source_branch": {
7285
Type: schema.TypeString,
7386
Default: "main",
7487
Optional: true,
7588
RequiredWith: []string{"autocreate_branch"},
7689
},
90+
// lintignore:XS001 // No changes to old schema versions
7791
"autocreate_branch_source_sha": {
7892
Type: schema.TypeString,
7993
Optional: true,

github/resource_github_repository_test.go

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,51 +1379,6 @@ resource "github_repository" "private" {
13791379
},
13801380
})
13811381
})
1382-
}
1383-
1384-
func Test_expandPages(t *testing.T) {
1385-
t.Run("expand Pages configuration with workflow", func(t *testing.T) {
1386-
input := []any{map[string]any{
1387-
"build_type": "workflow",
1388-
"source": []any{map[string]any{}},
1389-
}}
1390-
1391-
pages := expandPages(input)
1392-
if pages == nil {
1393-
t.Fatal("pages is nil")
1394-
}
1395-
if pages.GetBuildType() != "workflow" {
1396-
t.Errorf("got %q; want %q", pages.GetBuildType(), "workflow")
1397-
}
1398-
if pages.GetSource().GetBranch() != "main" {
1399-
t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main")
1400-
}
1401-
})
1402-
1403-
t.Run("expand Pages configuration with source", func(t *testing.T) {
1404-
input := []any{map[string]any{
1405-
"build_type": "legacy",
1406-
"source": []any{map[string]any{
1407-
"branch": "main",
1408-
"path": "/docs",
1409-
}},
1410-
}}
1411-
1412-
pages := expandPages(input)
1413-
if pages == nil {
1414-
t.Fatal("pages is nil")
1415-
}
1416-
if pages.GetBuildType() != "legacy" {
1417-
t.Errorf("got %q; want %q", pages.GetBuildType(), "legacy")
1418-
}
1419-
if pages.GetSource().GetBranch() != "main" {
1420-
t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main")
1421-
}
1422-
if pages.GetSource().GetPath() != "/docs" {
1423-
t.Errorf("got %q; want %q", pages.GetSource().GetPath(), "/docs")
1424-
}
1425-
})
1426-
14271382
t.Run("forks a repository without error", func(t *testing.T) {
14281383
randomID := acctest.RandString(5)
14291384
testRepoName := fmt.Sprintf("%sfork-%s", testResourcePrefix, randomID)
@@ -1549,6 +1504,50 @@ func Test_expandPages(t *testing.T) {
15491504
})
15501505
}
15511506

1507+
func Test_expandPages(t *testing.T) {
1508+
t.Run("expand Pages configuration with workflow", func(t *testing.T) {
1509+
input := []any{map[string]any{
1510+
"build_type": "workflow",
1511+
"source": []any{map[string]any{}},
1512+
}}
1513+
1514+
pages := expandPages(input)
1515+
if pages == nil {
1516+
t.Fatal("pages is nil")
1517+
}
1518+
if pages.GetBuildType() != "workflow" {
1519+
t.Errorf("got %q; want %q", pages.GetBuildType(), "workflow")
1520+
}
1521+
if pages.GetSource().GetBranch() != "main" {
1522+
t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main")
1523+
}
1524+
})
1525+
1526+
t.Run("expand Pages configuration with source", func(t *testing.T) {
1527+
input := []any{map[string]any{
1528+
"build_type": "legacy",
1529+
"source": []any{map[string]any{
1530+
"branch": "main",
1531+
"path": "/docs",
1532+
}},
1533+
}}
1534+
1535+
pages := expandPages(input)
1536+
if pages == nil {
1537+
t.Fatal("pages is nil")
1538+
}
1539+
if pages.GetBuildType() != "legacy" {
1540+
t.Errorf("got %q; want %q", pages.GetBuildType(), "legacy")
1541+
}
1542+
if pages.GetSource().GetBranch() != "main" {
1543+
t.Errorf("got %q; want %q", pages.GetSource().GetBranch(), "main")
1544+
}
1545+
if pages.GetSource().GetPath() != "/docs" {
1546+
t.Errorf("got %q; want %q", pages.GetSource().GetPath(), "/docs")
1547+
}
1548+
})
1549+
}
1550+
15521551
func TestGithubRepositoryTopicPassesValidation(t *testing.T) {
15531552
resource := resourceGithubRepository()
15541553
schema := resource.Schema["topics"].Elem.(*schema.Schema)

0 commit comments

Comments
 (0)