Skip to content

Address @stevehipwell review: code idioms, lint, docs#4

Merged
sprioriello merged 3 commits into
sprioriello:feat/organization-security-configurationfrom
casey-robertson-paypal:fix/address-stevehipwell-review
Jun 24, 2026
Merged

Address @stevehipwell review: code idioms, lint, docs#4
sprioriello merged 3 commits into
sprioriello:feat/organization-security-configurationfrom
casey-robertson-paypal:fix/address-stevehipwell-review

Conversation

@casey-robertson-paypal

Copy link
Copy Markdown

Addresses the review comments from @stevehipwell on integrations#3284 (follow-up to the now-merged #3).

Review comments addressed

  • Docs callout — dropped the **Note:** prefix from the ~> callouts (Registry callout syntax), both templates.
  • Import block examples — added import {} block examples (import-by-string-id.tf) alongside the terraform import command, both resources.
  • meta patternfunc(..., m any) + meta, _ := m.(*Owner) + client := meta.v3client, across all CRUD in both resources.
  • Type assertions — comma-ok on d.Get for required fields.
  • tflog — collapsed to single-line calls.
  • errors.AsType — replaced errors.As + var declaration with errors.AsType[*github.ErrorResponse].

util_ filename (the two structural comments)

Renamed util_security_configuration.gosecurity_configuration.go to drop the generic util_ prefix (per go.instructions.md). I kept expandCodeSecurityConfigurationCommon / setCodeSecurityConfigurationState shared rather than colocating/duplicating them into each resource file: the enterprise config is the org config minus delegated bypass, so duplicating would copy ~200 lines across both resources and duplicate the table-driven unit tests added in earlier review. Happy to fully inline them into each resource file instead if you'd prefer — just say the word.

Data sources

Re your question about matching data sources: agree those make sense as a separate follow-up PR/issue rather than expanding this one.

Verification

go build, go vet, golangci-lint (0 issues), gofmt, and tfplugindocs validate all clean. Full org acceptance suite 6/6 against a real GHAS org; no leftover resources. Enterprise CRUD assertions mirror the org tests and compile, but skip without a live enterprise.

Per @stevehipwell review on integrations#3284:
- Remove the '**Note:**' prefix from the ~> callout (Registry callout syntax)
- Add import {} block examples (import-by-string-id.tf) alongside the
  terraform import command, for both resources
Per @stevehipwell review on integrations#3284, across both resources' CRUD:
- meta param: func(... m any) + meta, _ := m.(*Owner); client := meta.v3client
- comma-ok type assertions on d.Get for required fields
- single-line tflog calls
- errors.AsType[*github.ErrorResponse] instead of errors.As + var decl
…n; satisfy linters

- Drop the generic util_ filename prefix (go.instructions.md: avoid util/common/base).
  Functions remain shared between the org and enterprise resources (the enterprise
  config is the org config minus delegated bypass) and keep their table-driven unit
  tests, so they are not duplicated into each resource file.
- golangci-lint --fix: godot (comment periods), modernize (Ptr(x) -> new(x)), gofmt.
@sprioriello sprioriello merged commit 6690cc5 into sprioriello:feat/organization-security-configuration Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants